How should I use moment-timezone with webpack?

Solution 1:

You can fix this by adding the JSON loader to your webpack configuration.

$npm install json-loader

And add it to your loaders in webpack.config.js. Don't forget to add the extension as well.

{
  module: {
    loaders: [
        {include: /\.json$/, loaders: ["json-loader"]}
    ]
  },
  resolve: {
    extensions: ['', '.json', '.jsx', '.js']
  }
}

Solution 2:

If you're using webpack 2.x (currently in beta)

npm install json-loader

then include this in your rules

{
    test: /\.json$/,
    loader: "json-loader"
}