25 lines
550 B
JavaScript
25 lines
550 B
JavaScript
|
import esbuild from "esbuild";
|
||
|
|
||
|
/**
|
||
|
* @type {esbuild.Plugin}
|
||
|
*/
|
||
|
const makeAllPackagesExternalPlugin = {
|
||
|
name: "make-all-packages-external",
|
||
|
setup(build) {
|
||
|
const filter = /^[^./|~]|^\.[^./]|^\.\.[^/]/; // Must not start with "/" or "./" or "../"
|
||
|
build.onResolve({ filter }, (args) => ({
|
||
|
path: args.path,
|
||
|
external: true,
|
||
|
}));
|
||
|
},
|
||
|
};
|
||
|
|
||
|
await esbuild.build({
|
||
|
entryPoints: ["src/index.ts"],
|
||
|
bundle: true,
|
||
|
outfile: "dist/index.js",
|
||
|
platform: "node",
|
||
|
target: "esnext",
|
||
|
plugins: [makeAllPackagesExternalPlugin],
|
||
|
});
|