11

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?

3

1 Answer 1

14

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

3
  • BTW I had the issue while code-splitting with React-Loadable
    – t3__rry
    Oct 3, 2018 at 14:18
  • 1
    Thanks a lot to this answer. I've been banging my head trying to figure out the solution. I had the same issue with two builds on same page. one project was old using webpack 3, other one was new. May 19, 2020 at 8:07
  • 1
    Glad it helped, it's a pretty difficult issue to debug
    – t3__rry
    May 19, 2020 at 9:59

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.