Skip to content

Commit 79ed60e

Browse files
committed
hardcode watch to development
1 parent 9d1ed09 commit 79ed60e

File tree

1 file changed

+4
-36
lines changed

1 file changed

+4
-36
lines changed

packages/react-scripts/config/webpack.config.watch.js

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
// @remove-on-eject-end
1111
'use strict';
12+
process.env.NODE_ENV = 'development';
1213
const autoprefixer = require('autoprefixer');
1314
const webpack = require('webpack');
1415
const HtmlWebpackPlugin = require('html-webpack-plugin');
@@ -17,7 +18,6 @@ const ManifestPlugin = require('webpack-manifest-plugin');
1718
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin');
1819
const paths = require('./paths');
1920
const getClientEnvironment = require('./env');
20-
const isProduction = require('react-dev-utils/isProduction');
2121

2222
// @remove-on-eject-begin
2323
// `path` is not used after eject - see https://github.com/facebookincubator/create-react-app/issues/1174
@@ -61,7 +61,7 @@ const extractTextPluginOptions = shouldUseRelativeAssetPaths
6161
module.exports = {
6262
watch: true,
6363
context: paths.appSrc,
64-
devtool: isProduction() ? 'source-map' : 'cheap-module-source-map',
64+
devtool: 'cheap-module-source-map',
6565
// There are no support for live reloading changes in this mode
6666
entry: [require.resolve('./polyfills'), paths.appIndexJs],
6767
output: {
@@ -125,7 +125,7 @@ module.exports = {
125125
options: {
126126
// TODO: consider separate config for production,
127127
// e.g. to enable no-console and no-debugger only in production.
128-
configFile: path.join(__dirname, '../.eslintrc'),
128+
configFile: path.join(__dirname, '../eslintrc'),
129129
useEslintrc: false,
130130
},
131131
// @remove-on-eject-end
@@ -239,44 +239,12 @@ module.exports = {
239239
new HtmlWebpackPlugin({
240240
inject: true,
241241
template: paths.appHtml,
242-
minify: isProduction()
243-
? // Minify the code if in production.
244-
{
245-
removeComments: true,
246-
collapseWhitespace: true,
247-
removeRedundantAttributes: true,
248-
useShortDoctype: true,
249-
removeEmptyAttributes: true,
250-
removeStyleLinkTypeAttributes: true,
251-
keepClosingSlash: true,
252-
minifyJS: true,
253-
minifyCSS: true,
254-
minifyURLs: true,
255-
}
256-
: false,
257242
}),
258243
// Makes some environment variables available to the JS code, for example:
259244
// if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`.
260245
// It is absolutely essential that NODE_ENV was set to production here.
261246
// Otherwise React will be compiled in the very slow development mode.
262247
new webpack.DefinePlugin(env.stringified),
263-
// Minify js if in production.
264-
isProduction()
265-
? new webpack.optimize.UglifyJsPlugin({
266-
compress: {
267-
screw_ie8: true, // React doesn't support IE8
268-
warnings: false,
269-
},
270-
mangle: {
271-
screw_ie8: true,
272-
},
273-
output: {
274-
comments: false,
275-
screw_ie8: true,
276-
},
277-
sourceMap: true,
278-
})
279-
: false,
280248
// Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`.
281249
new ExtractTextPlugin({
282250
filename: cssFilename,
@@ -288,7 +256,7 @@ module.exports = {
288256
new ManifestPlugin({
289257
fileName: 'asset-manifest.json',
290258
}),
291-
].filter(Boolean), // remove falsy plugin on development
259+
],
292260
// Some libraries import Node modules but don't use them in the browser.
293261
// Tell Webpack to provide empty mocks for them so importing them works.
294262
node: {

0 commit comments

Comments
 (0)