ReferenceError: webpackJsonp is not defined

Here is my webpack configuration file , im getting this error on loading the html’s containing both p1.chunk and p2.chunk
var commonResourcePlugin = require(‘webpack/lib/optimize/CommonsChunkPlugin’)
module.exports = {

    entry: {

        p1: './js/components/character/main-character.jsx',
        p2: './js/components/character/character_template/character_template_entry.jsx'
    },

    output: {
        filename: './js/[name].chunk.js'
    },
    externals: {
        "jquery": "jQuery",
        "$": "$",
        "React": "React"
    },
    module: {
        loaders: [
            {
                test: /\.jsx$/,
                loader: 'jsx-loader'
            } // loaders can take parameters as a querystring
        ]
    },
    resolve: {
        extensions: ['', '.js', '.json', '.coffee', 'jsx']
    },
    plugins: [
        new commonResourcePlugin("./js/commons.chunk.js");
    ]
};

Author: Fantashit

3 thoughts on “ReferenceError: webpackJsonp is not defined

  1. @sjelfull I think it means the loading order of your app and vendor files in your html. I had this problem and I realised that my <script src='app.js'> was before <script src='vendor.js'>. Switching orders fixed it.

  2. I have understanded.
    because we use webpack.optimize.CommonsChunkPlugin plugin but not follow in html file
    Need to introduce public JS files in the HTML page, like this:

    <script src="common.js"></script>
    <script src="list.js"></script>

Comments are closed.

ReferenceError: webpackJsonp is not defined

OS?

Windows 10

Versions.

@angular/cli: 1.0.0-beta.32.3
node: 7.5.0
os: win32 x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-beta.32.3
@angular/compiler-cli: 2.4.8

I use commands ng build --prod or ng build --prod --aot for production my projects,
after connected file in document index.html -> errors occur:

Uncaught ReferenceError: webpackJsonp is not defined
at vendor.bundle.js:1

and

TypeError: Cannot read property ‘call’ of undefined
at r (inline.fc1c1a5….bundle.js:1)
at Object.585 (main.caf6b13….bundle.js:11)
at r (inline.fc1c1a5….bundle.js:1)
Previously everything worked fine… thank you in advance

Author: Fantashit

1 thought on “ReferenceError: webpackJsonp is not defined

  1. The problem was with uglify-js@2.8.0. Fresh installs will pull uglify-js@2.8.1 which resolved the issue for me.

Comments are closed.