From 47434492419e3548e7159eda25b484065f7907d8 Mon Sep 17 00:00:00 2001 From: Ryan Carniato Date: Mon, 13 Dec 2021 12:46:24 -0800 Subject: [PATCH] fix: local esm resolution --- build.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build.ts b/build.ts index b327630..5e8fc4a 100644 --- a/build.ts +++ b/build.ts @@ -37,7 +37,21 @@ import { build, BuildOptions } from "esbuild"; build({ ...opts, format: "esm", + bundle: true, + splitting: true, outExtension: { ".js": ".mjs" }, + plugins: [ + { + name: "make-all-packages-external", + setup(build) { + const filter = /^[^./]|^\.[^./]|^\.\.[^/]/; // Must not start with "/" or "./" or "../" + build.onResolve({ filter }, (args) => ({ + path: args.path, + external: true, + })); + }, + }, + ], }), ]); })().catch((err) => {