大佬教程收集整理的这篇文章主要介绍了如何解决这个问题“Uncaught ReferenceError: vendor_library is not defined”,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我遇到了一个奇怪的问题,我试图使用 DllPlugin、DllReferencePlugin 和 AddAssetHTMLPlugin 优化我的 webpack 包构建时间,当我运行“npm run build”时它运行良好。生成了名为 vendor.dll.Js 的文件并注入到 index.HTML 中。但是,当我运行“npm run local”时,浏览器中抛出了上述错误。谁知道怎么修它?任何建议将不胜感激。
我的部分代码如下(对不起,我不能在这里发布我所有的代码)
webpack.dll.config.Js
@H_8_9@module.exports = { vendor: [ 'core-Js','lodash','axios','react','react-dom','redux',] },output:{ path:path.join(__dirname,'/../build/'),filename:'[name].dll.Js',library:'[name]_library' },plugins:[ new webpack.DllPlugin({ path:path.join(__dirname,'./../build/','[name]-manifest.Json'),name:'[name]_library',context:path.join(__dirname,'./../build/') }),] }
webpack.config.default.Js
@H_8_9@module.exports = () => { //... webpack: (webpackConfig,webpack,env) => { webpackConfig.plugins.push( new HTMLWebpackPlugin({ template: path.resolve(__dirname,'../server/vIEw/home.HTML'),// template HTML file Minify: { removeComments: false } }) ); webpackConfig.plugins.push( new webpack.DllReferencePlugin({ context:path.join(__dirname,manifest: require('../build/vendor-manifest.Json') }) ); webpackConfig.plugins = (webpackConfig.plugins || []).concat([ new AddAssetHTMLPlugin({ filepath:path.resolve(__dirname,'../build/vendor.dll.Js'),includesourcemap: false,hash: true }),]); } }
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的如何解决这个问题“Uncaught ReferenceError: vendor_library is not defined”全部内容,希望文章能够帮你解决如何解决这个问题“Uncaught ReferenceError: vendor_library is not defined”所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。