Webpack build error

Having some problems with webpack. It builds fine, but when I open my site, I get:Getting error: "Uncaught ReferenceError: webpackJsonp is not defined"

I believe my CommonsChunkPlugin is running before my application is connected?

This can help to find out what I have in my configuration src/config/webpack.config.js, which is built on dist/js/.

Read https://medium.com/@MarkEwersDev/note-to-self-if-you-ever-get-this-uncaught-referenceerror-webpackjsonp-is-not-defined-message-and-d354f5c4d335#.9cysuil5p and https : //github.com/webpack/webpack/issues/368 but nothing helps if I am missing something.

  devtool: 'source-map',
  entry: {
    vendor: [
      'react', 'react-dom', 'react-router', 'react-helmet', 'react-redux', 'moment-timezone', 'cookies-js', 'superagent', 'classnames', 'es6-promise'
    ],
    app: [
      './src/client/entry',
      './scss/main.scss',

    ]
  }
  output:{
    path: __dirname + '../../dist/js',
    filename: 'app.js'
  }
  plugins:[
    new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js'),

    new ExtractTextPlugin('../css/app.css', {
        allChunks: true
    }),
    new webpack.DefinePlugin({
      'process.env':{
        'NODE_ENV': JSON.stringify('production')
      }
    }),
    new webpack.optimize.AggressiveMergingPlugin(),
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: true
      },
      output: {
        comments: false
      }
    }),
    ...persistentPlugins
  ],
+4
source share
2 answers

webpackJsonp commons, commons (vendor.js ) <script>. <script async>.

, , output.filename . [name].js app.js.

+11

. , , + , webpack , . node. , .

webpack, , , - -.

: (AggressiveMergingPlugin, DedupePlugin UglifyJsPlugin), , .

, , / . , , :)

0

Source: https://habr.com/ru/post/1650604/


All Articles