Answer the question
In order to leave comments, you need to log in
What does the error "React is running in production mode, but dead code elimination has not been applied" mean?
What might be causing this error?
On the local everything works, but when I send it to the build, then after a while the following error occurs on the build
Webpack prod -
const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: [
'./dev/js/index'
],
output: {
path: path.join(__dirname, 'dist/js'),
publicPath: "/js/",
filename: 'bundle.js',
},
target: 'node',
module: {
loaders: [
{
test: /\.(js|jsx)$/,
include: path.join(__dirname, 'dev/js'),
exclude: /node_modules/,
loader: "babel-loader",
options: {
presets: [ 'react', 'es2015', 'stage-0']
}
},
{
test: /\.(sass|scss)/,
include: path.join(__dirname, 'dev/sass'),
loader: 'style-loader!css-loader!sass-loader'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
loaders: ['url-loader']
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader'
}
]
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new UglifyJSPlugin({
"mangle": {
"screw_ie8": true
},
"compress": {
"screw_ie8": true,
"warnings": false
},
"sourceMap": false
})
],
};
const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
module.exports = {
entry: [
'./dev/js/index'
],
output: {
path: path.join(__dirname, 'dist/js'),
publicPath: "/js/",
filename: 'bundle.js',
},
target: 'node',
module: {
loaders: [
{
test: /\.(js|jsx)$/,
include: path.join(__dirname, 'dev/js'),
exclude: /node_modules/,
loader: "babel-loader",
options: {
presets: [ 'react', 'es2015', 'stage-0']
}
},
{
test: /\.(sass|scss)/,
include: path.join(__dirname, 'dev/sass'),
loader: 'style-loader!css-loader!sass-loader'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
loaders: ['url-loader']
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader'
}
]
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production'),
'NODE_CUSTOM_MODE': JSON.stringify('development'),
}
}),
new UglifyJSPlugin({
"mangle": {
"screw_ie8": true
},
"compress": {
"screw_ie8": true,
"warnings": false
},
"sourceMap": false
})
],
};
Answer the question
In order to leave comments, you need to log in
At the end of the text of the error is a link with the answer to your question.
Read more: Tyts , tyts
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question