Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating to Webpack 4 from Webpack 3

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:

Uncaught TypeError: (intermediate value)(intermediate value).push is not a function

On:

(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["Index"],{

This is my Webpack output settings:

output: {
    filename,
    path: path.resolve(__dirname, 'public', 'build', 'js'),
    jsonpFunction: 'webpackJsonp', // TODO gotta figure that out
},

What am I doing wrong?

like image 641
Pablo Avatar asked Sep 21 '18 15:09

Pablo


1 Answers

Just had the same issue and I have found this thread https://github.com/webpack/webpack/issues/6985

It seems to happen when you have modules bundled with Webpack < 4. I'm posting it here if it can be of any help.

Changing the output.jsonpFunction https://webpack.js.org/configuration/output/#output-jsonpfunction to jsonpFunction solved it:

{
  output: {
    jsonpFunction: 'jsonpFunction',
    ...
  }
}

Credit goes to goes to @sokra (the creator of Webpack): https://github.com/webpack/webpack/issues/6985#issuecomment-380795070

like image 93
t3__rry Avatar answered Nov 12 '22 19:11

t3__rry