Skip to content

v2.x configures external cdn import in vue-cli-4, there is no suitable global variable name #4653

@jianglei81

Description

@jianglei81
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

Version: 2.2.7

在v1.x时,在vue.config.js中如下配置即可:
configureWebpack: {
externals: {
'vue': 'Vue',
'vue-router': 'VueRouter',
'ant-design-vue': 'antd',
}
}
Vue和VueRouter都是它们各自提供的全局变量名,然而ant-design-vue到了v2.x,antd不再是全局变量,看源代码也找不到一个全局变量,只能将ant-design-vue打包后使用,这将形成一个高达15MB 的js文件,按需加载带来使用上的麻烦,且不能解决根本问题,使用的组件多的话最终还是都打到一个js文件里。
也许是我水平有限,找不出这个正确配置该是什么,如果已有支持,还请赐教该怎么配置。

What does the proposed API look like?

提供全局变量名

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions