Closed grahamcrackers closed 7 years ago
getting that error generally means that you are processing the contents of a html file, when you think you're processing something else (js, css, etc). Usually this has to do with the server returning your default html page when you make a request for something else. I see this a lot with express. Not sure why you're seeing it, but that's the symptom.
try my aproach in version >2.2: First: //var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('shared.js'); var commonsPlugin = new webpack.optimize.CommonsChunkPlugin({ name: ['shared'] }); Last: // resolve: { extensions: ['', '.js', '.es6'] } resolve: { extensions: ['.js', '.es6'] }
@grahamcrackers, we are facing a much similar issue in our project. Were you able to solve this issue. Could you please share your resolution if you have one. Thank you...
I'm not sure if this is a webpack 2 bug or not but for anyone on Webpack 2 (specifically i'm on 2.2.1):
When trying to use the CommonsChunksPlugin while trying to create multiple bundles, webpack would compile fine but I was getting errors in chrome saying:
Uncaught SyntaxError: Unexpected token <
Uncaught ReferenceError: webpackJsonp is not defined at home.js:1
In the video for building multiple files, Joe uses the plugin like this
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('shared.js');
but you don't need the define shared.js with an extention, just use
webpack.optimize.CommonsChunkPlugin('shared');