Skip to content

[vue] 如何解决vue打包vendor过大的问题? #343

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

[vue] 如何解决vue打包vendor过大的问题?

Activity

changed the title [-][vue] 如何解决vue打包wendor过大的问题?[/-] [+][vue] 如何解决vue打包vendor过大的问题?[/+] on Jun 28, 2019
persist-xyz

persist-xyz commented on Jul 3, 2019

@persist-xyz

1、在webpack.base.conf.js新增externals配置,表示不需要打包的文件,然后在index.html中通过CDN引入

externals: {
    "vue": "Vue",
    "vue-router": "VueRouter",
    "vuex": "Vuex",
    "element-ui": "ELEMENT",
    "BMap": "BMap"
  }

2、使用路由懒加载 官网

Ankhyang

Ankhyang commented on Mar 9, 2021

@Ankhyang

开启gzip压缩

wanlixi

wanlixi commented on Apr 8, 2022

@wanlixi

CDN
tree-shaking
splitChunksPlugin
commonChunksPlugin
路由懒加载

1101334809

1101334809 commented on Aug 31, 2022

@1101334809

1、在webpack.base.conf.js新增externals配置,表示不需要打包的文件,然后在index.html中通过CDN引入

externals: {
    "vue": "Vue",
    "vue-router": "VueRouter",
    "vuex": "Vuex",
    "element-ui": "ELEMENT",
    "BMap": "BMap"
  }

2、使用路由懒加载 官网

CDN引入会有些许问题,https模式下会有安全验证,使得cdn引入失败。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @haizhilin2013@wanlixi@persist-xyz@1101334809@Ankhyang

        Issue actions

          [vue] 如何解决vue打包vendor过大的问题? · Issue #343 · haizlin/fe-interview