![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@warp-ds/esbuild-plugin
Advanced tools
Used along with [@warp-ds/elements-core](https://github.com/warp-ds/warp-element) this ESBuild plugin lets you get a minimal set of UnoCSS utility CSS classes for your `WarpElement.styles` property.
Used along with @warp-ds/elements-core this ESBuild plugin lets you get a minimal set of UnoCSS utility CSS classes for your WarpElement.styles
property.
npm install @warp-ds/esbuild-plugin
// build.js
import * as glob from "glob";
import * as esbuild from "esbuild";
import * as eik from "@eik/esbuild-plugin";
import warpPlugin from "@warp-ds/esbuild-plugin";
const useWatch = (process.argv[2] && process.argv[2] === "watch") || false;
/**
* @type {import("esbuild").BuildOptions}
*/
const clientBuildOptions = {
entryPoints: ["./src/client/client.js"],
format: "esm",
logLevel: "info", // Adjust this if you get problems
bundle: true,
platform: "browser",
sourcemap: true,
plugins: [
eik.plugin(), // Enables the use of Eik import maps
warpPlugin(), // Ensures WARP gets added to components
],
minify: true,
target: ["es2022"],
outfile: "./public/${{ values.name }}.js",
};
const files = glob.sync("./src/**/*.js");
/**
* @type {import("esbuild").BuildOptions}
*/
const serverBuildOptions = {
entryPoints: files,
outdir: "./build",
format: "esm",
logLevel: "info", // Adjust this if you get problems
bundle: false,
platform: "node",
sourcemap: true,
plugins: [
warpPlugin(), // Ensures WARP gets added to server-side rendered components
],
minify: false,
target: ["es2022"],
};
// Build or watch
if (useWatch) {
const ctxClient = await esbuild.context(clientBuildOptions);
const ctxServer = await esbuild.context(serverBuildOptions);
await Promise.all([ctxClient.watch(), ctxServer.watch()]);
} else {
await Promise.all([esbuild.build(clientBuildOptions), esbuild.build(serverBuildOptions)]);
}
// Component.js
export class HelloWorld extends WarpElement {
static styles = [
css`
@warp-css;
`,
WarpElement.styles,
];
render() {
return html`
<p class="text-xl p-32 m-16">
Hello, World!
</p>
`;
}
}
if (!customElements.get("hello-world")) {
customElements.define("hello-world", HelloWorld);
}
FAQs
Used along with [@warp-ds/elements-core](https://github.com/warp-ds/warp-element) this ESBuild plugin lets you get a minimal set of UnoCSS utility CSS classes for your `WarpElement.styles` property.
The npm package @warp-ds/esbuild-plugin receives a total of 2 weekly downloads. As such, @warp-ds/esbuild-plugin popularity was classified as not popular.
We found that @warp-ds/esbuild-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.