Skip to content

not able to use external "vue" script #6149

Open
vuejs/vue-loader
#1774
@Urie96

Description

@Urie96

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 line

exports.install = function (vue, browserify) {
  if (installed) { return }
  installed = true

  Vue = vue.__esModule ? vue.default : vue
  version = Vue.version.split('.').map(Number)

Vue is pending Promise, so version is undefined

Steps to reproduce

  • vue create temp
  • select vue 2 and disable all plugin
  • vi vue.config.js
module.exports = {
  configureWebpack: (config) => ({
    externalsType: 'script',
    externals: {
        vue: ['https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js', 'Vue'],
    }})
}
  • npm run serve
  • open chrome
  • open F12 and click console

What is expected?

Be able to see vue.js page

What is actually happening?

white page and chrome console throw error

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions