Load Vue as a bundler dependency when using wc modeΒ #1714
Description
What problem does this feature solve?
First of all, great job with the client. Have used React and create-react-app
for a while now, which I always needed to extract, to be able to have it the way I wanted to. Not with vue-cli
, great job! Anyway.
I would like to be able to use the build with wc
mode as a normal dependency loadable via a bundler.
As the documentation says:
In lib mode, Vue is externalized. This means the bundle will not bundle Vue even if your code imports Vue. If the lib is used via a bundler, it will attempt to load Vue as a dependency through the bundler; otherwise, it falls back to a global Vue variable.
This is different to the wc
or wc-async
mode:
In web component mode, Vue is externalized. This means the bundle will not bundle Vue even if your code imports Vue. The bundle will assume Vue is available on the host page as a global variable.
Is there a reason to only load Vue from the global variable? I already found the corresponding code and am now trying to customise the behaviour via chainWebpack
, although I don't see why this isn't the default for both modes.
Thanks in advance!
Different topic: When using vue build --watch
, vue-cli
generates hot updates and includes the corresponding webpack HMR code in the build. Guess that is intended?
What does the proposed API look like?
Using vue build --mode wc
would extract a build file loadable as a normal page asset or bundler dependency.