Error: Loading chunk 0 failed. - webpack tries to load 0.js

Viewed 15638

I have following project structure:

|-mainFile.js
|-scripts -
          |-Library1.js
          |-Library2.js

Library files use requirejs define([], function() {}) syntax.

I've therefore put this into the webpack.config.js:

module.exports = {
    resolve: {
        modules: [
            path.resolve(__dirname, 'scripts'),
            // The normal path
            "node_modules"
        ]
    },
    /** ... **/
}

I then do this in mainFile.js which is entry point for webpack:

require(["Library1", "Library2"], function(Library1, Library2) { ... });

And I get this error:

GET http://localhost:3000/0.js [HTTP/1.1 404 Not Found 3ms]
Error: Loading chunk 0 failed.
Stack trace:
onScriptComplete@http://localhost:3000/player/webpack_build.js:100:24
                     webpack_build.js:146:52
The resource from “http://localhost:3000/0.js” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff).[Learn More]
test_file.html Error: Loading chunk 0 failed.

So webpack tries to load some 0.js file. What's that supposed to be?

2 Answers
Related