-
-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vue-demi adds @vue/composition-api to bundle, even if it is declared as external #151
Comments
Using a regex for externals revealed the following: // vite.config.ts
external: id => {
if (id === 'vue') return true
return /\@vue\/composition-api/gi.test(id)
}, results in define(["@vue/composition-api", "vue", "@vue/composition-api/dist/vue-composition-api.mjs"], factory) and the following warning
|
You need to external |
I was able to find a temporary fix, by adding an alias: resolve: {
alias: [
{ find: '@vue/composition-api/dist/vue-composition-api.mjs', replacement: '@vue/composition-api' },
],
}, |
👋 Same issue here. I use (and maintain) a package that depends on After installing this package on another project — which is itself bundled via I've workaround it using a webpack // webpack.config.js
resolve: {
alias: {
'@vue/composition-api$': 'path/to/node_modules/@vue/composition-api/dist/vue-composition-api.esm.js' // the one you want
}
} EDIT: i had a similar issue not related with |
external: [
'vue',
'@vue/composition-api',
+ 'vue-demi'
] And you should import everything from |
Issue
My app breaks when adding any library that has
vue-demi
as a dependency, as it adds@vue/composition-api
code to the final bundle, although I declared@vue/composition-api
as external.I resolve
@vue/composition-api
in an UMD/AMD environment automatically. Because there are two instances of@vue/composition-api
present, the app breaks.Repro
@vue/composition-api
and@vueuse/core
@vueuse/core
@vue/composition-api
as external@vue/composition-api
end up in the bundle.Also see this repro: https://github.com/johannes-z/vue-demi-repro. See https://github.com/johannes-z/vue-demi-repro/blob/main/dist/mylib.js#L1014
The text was updated successfully, but these errors were encountered: