-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
not able to use external "vue" script #6149
Comments
It seems it can be fixed in import Vue from 'vue'
api.install(Vue) then webpack can know when 'vue' is used and await Promise of the script before using it. |
@fangbinwei It works fine if serve static files after |
Some HMR codes use 'vue' by Using require('vue').then(Vue => {
new Vue({})
}) if use vue like below, webpack will transform codes and handle the Promise automatically import Vue from 'vue'
new Vue({}) |
@fangbinwei 谢谢解答,你上面讲的我配置不了哒,所以是要等待新的发布哇 |
是的, 现在只能先这样 /** @type {import('@vue/cli-service').ProjectOptions} */
module.exports = {
configureWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
return {
externalsType: 'script',
externals: {
vue: ['https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js', 'Vue']
}
}
}
}
} |
Version
5.0.0-alpha.0
Reproduction link
https://github.com/Urie96/vue-cli-issue
Environment info
webpack5 has new feature externalsType, I try to extern vue by script, but i received a error in browser console when import
*.vue
, it occur at last lineVue
is pending Promise, so version is undefinedSteps to reproduce
vue create temp
vi vue.config.js
console
What is expected?
Be able to see vue.js page
What is actually happening?
white page and chrome console throw error
The text was updated successfully, but these errors were encountered: