本文介绍了从Webpack 3迁移到Webpack 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试迁移到Webpack 4,但这真的很痛苦。在将Webpack 3插件移动到Webpack 4原生内容之后的几天,我得到 js ,据说可以正常呈现,但是当我访问我的网站时,我收到了这条消息在控制台上:I am trying to migrate to Webpack 4, but is has been a real pain. After couple of days working on moving Webpack 3 plugins to Webpack 4 native stuff, I got the js to be rendered fine supposedly, but when I go to my website I got this message on the console: 未捕获TypeError :(中间值)(中间值).push不是函数开: (window [webpackJsonp] = window [webpackJsonp ] || [])。push([[Index],{这是我的Webpack 输出设置:This is my Webpack output settings:output: { filename, path: path.resolve(__dirname, 'public', 'build', 'js'), jsonpFunction: 'webpackJsonp', // TODO gotta figure that out},我做错了什么?推荐答案刚刚遇到同样的问题我找到了这个帖子 https://github.com/webpack / webpack / issues / 6985Just had the same issue and I have found this thread https://github.com/webpack/webpack/issues/6985当您将模块与 Webpack 捆绑在一起时,似乎会发生这种情况。 4.如果有任何帮助,我会在这里张贴。It seems to happen when you have modules bundled with Webpack < 4. I'm posting it here if it can be of any help.更改 output.jsonpFunction https://webpack.js.org/configuration/output/#output-jsonpfunction 到 jsonpFunction 解决了它:{ output: { jsonpFunction: 'jsonpFunction', ... }}信用转到@sokra(Webpack的创建者): https://github.com/webpack/webpack/issues/6985#issuecomment-380795070Credit goes to goes to @sokra (the creator of Webpack): https://github.com/webpack/webpack/issues/6985#issuecomment-380795070 这篇关于从Webpack 3迁移到Webpack 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-16 00:22