esbuild bundle=true causing unplugin-auto-import invalid #14572
Unanswered
viva-la-v
asked this question in
CLI - BEX mode
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I've just start using quasar to build browser extensions, when I'm trying to reuse codes between
src-bex/background.ts
andsrc
, I found out that the modules auto imported byunplugin-auto-import
won't be available in the built outputdist/backgroud.js
.I see you are using
bundle: true
to inline all the modules needed by background/content/dom script and bundle them into single outputs.I've extended
esbuild
config like this:Yet, the modules supposed to be auto imported still won't be inlined into the output files.
I'm guessing this is caused by the
bundle=true
feature can only inline the imports analyzable at compile-time but not runtime (https://esbuild.github.io/api/#non-analyzable-imports), while the auto imported modules are actually analyzable until runtime (dynamic imports?). Thus,esbuild
in bundle mode does not supportunplugin-auto-import
?It is a bit hideous to collect all the shared code in one special place and only able to use manual import on them in the bex scripts.
Are you planning on to use
Vite
to build background/content/dom script as well as theBEX UI
itself, instead of using an extra build toolesbuild
? I thinkVite
also support building bundled single script file like this vitejs/vite#2739.Beta Was this translation helpful? Give feedback.
All reactions