Closed wangzl1163 closed 4 years ago
dll_library
@wangzl1163 具体的报错信息有吗? 先执行npm run dll 了没有? 文件是否已经注入到index.html上去,页面是否已经成功加载dll.js 文件?
dll_library
@wangzl1163 具体的报错信息有吗? 先执行npm run dll 了没有? 文件是否已经注入到index.html上去,页面是否已经成功加载dll.js 文件?
@fingerpan 问题已经解决,webpack配置有问题。
production模式编译后部署到站点页面加载时报dll_library is not defined错误。 我自己写了一个webpack.dll.config.js然后用webpack-cli进行打包,编译后部署到站点没有报错。 希望能排查一下,解决一下这个问题。
采用插件,配置如下:
pluginOptions: { dll: { entry: ['vue', 'vue-router', 'vuex', 'vue-i18n', 'vuex-persistedstate'], output: path.join(__dirname, './public/dll'), // 只在生产环境加入 webpack.DllReferencePlugin 插件 open: isProduction, inject: true } }
生成dll文件正常,编译时也正常。