From 0e34caa1b0f5ad43d9a6a5f1f8b1dcb1ae2a8982 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 21 Nov 2022 02:06:44 +0530 Subject: [PATCH] fix: Core build externals --- .vite/build.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vite/build.ts b/.vite/build.ts index f2dd7db05..07b20a385 100644 --- a/.vite/build.ts +++ b/.vite/build.ts @@ -56,7 +56,7 @@ interface BuildOptions { } export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions): InlineConfig => { - const external = ['require', 'fs', 'path']; + const external: (string | RegExp)[] = ['require', 'fs', 'path']; console.log(entryName, packageOptions[entryName]); const { name, file, packageName } = packageOptions[entryName]; let output: OutputOptions = [ @@ -80,7 +80,7 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions) ); // Core build is used to generate file without bundled dependencies. // This is used by downstream projects to bundle dependencies themselves. - external.push(...Object.keys(dependencies)); + external.push(new RegExp('^(?:' + Object.keys(dependencies).join('|') + ')(?:/.+)?$')); // This needs to be an array. Otherwise vite will build esm & umd with same name and overwrite esm with umd. output = [ {