From f758485f403e292f9152504ad0a60544611c06ce Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Tue, 23 Jan 2024 16:13:52 +0800 Subject: [PATCH] Optimize compiler --- src/components/Playground/compiler.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Playground/compiler.ts b/src/components/Playground/compiler.ts index 244c435..566eac9 100644 --- a/src/components/Playground/compiler.ts +++ b/src/components/Playground/compiler.ts @@ -58,7 +58,7 @@ class Compiler { format: 'esm', metafile: true, write: false, - plugins: [this.fileResolverPlugin(files, importMap)] + plugins: [this.fileResolverPlugin(files, importMap, entryPoints)] }) }) @@ -66,12 +66,16 @@ class Compiler { esbuild.stop() } - private fileResolverPlugin = (files: IFiles, importMap: IImportMap): Plugin => { + private fileResolverPlugin = ( + files: IFiles, + importMap: IImportMap, + entryPoints: string[] + ): Plugin => { return { name: 'file-resolver-plugin', setup: (build: PluginBuild) => { build.onResolve({ filter: /.*/ }, (args: esbuild.OnResolveArgs) => { - if (args.path === ENTRY_FILE_NAME) { + if (entryPoints.includes(args.path)) { return { namespace: 'OxygenToolbox', path: args.path