So this is the full error: You are currently using minified code outside of NODE_ENV === 'production'. This means that you are running a slower development build of Redux.
I am using a 3rd party charting library, CanvasJS, which needs access to the global scope. When I import it within any of my modules it seems the actual code breaks when in the browser (probably a this
problem).
I solved it by using Webpack, and having gulp bundle the bundle.min.js with the minified Charting library.
This works just fine until I try a production build. I think the reference to CanvasJS may have gotten mangled in the process.
My Webpack.config file:
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
var path = require('path');
module.exports = {
context: path.join(__dirname, "public"),
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/main.js",
resolve: {
alias: {
'react': 'react-lite',
'react-dom': 'react-lite'
}
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0'],
plugins: [ 'transform-class-properties', 'transform-decorators-legacy'],
}
}
]
},
output: {
path: __dirname + "/public/build/",
filename: "bundle2.min.js"
},
plugins: debug ? [] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin(),
// new webpack.optimize.AggressiveMergingPlugin()
new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }),
],
};
I have tried to mark CanvasJS as External, but this did not work either. How can I get Redux to not "run slow", and have references to global objects?