ERROR in file.js from UglifyJs SyntaxError: Unexpected token: name (xxxxx) [file.js:line,column]

Recently whilst upgrading from Webpack to Webpack2, I ran into this error which took a while to debug.

I was seeing the following error output:

ERROR in file.js from UglifyJs
SyntaxError: Unexpected token: name (DateRange) [file.js:line,column]
I went into my webpack config and turned minification off so that I could see the file which was being generated:

plugins: [
    ...
    new webpack.LoaderOptionsPlugin({
      minimize: false,
      debug: false
    }),
    new webpack.optimiz...
Read More

Conditionally load multiple Polyfills using Webpack, Promises and Code Splitting

For my latest react project, I wanted to be able to polyfill certain features which are missing in older browsers, yet not include them in my final code bundle if the browser the user is using already supports that feature.

This was a great problem for webpack's code splitting feature to solve!

After a quick google, I found a post from Ian Obermiller which set me on the correct path, however the post didn't expand on how to load multiple polyfills conditionally.

For example:
  • Safari is missing...
Read More

Output filename not configured error from Webpack

I couldn't find an answer to this simple issue, so I thought I'd quickly post one myself.

Whilst creating a new ReactJS app, I wanted to use Webpack to build all of my modules into a single bundle.

I had installed it globally by running npm install webpack -g and I had included it in my project by running npm install webpack --save-dev.

However, on running the webpack command, I was seeing the following output:
Output filename not configured.

The solution

Turns out it was simple. I had missed th...
Read More