Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

const autoprefixer = require('autoprefixer');
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
Expand All @@ -33,7 +34,7 @@ const env = getClientEnvironment(publicUrl);
// This is the development configuration.
// It is focused on developer experience and fast rebuilds.
// The production configuration is different and lives in a separate file.
module.exports = {
const config = {
// You may want 'eval' instead if you prefer to see the compiled output in DevTools.
// See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.
devtool: 'cheap-module-source-map',
Expand Down Expand Up @@ -285,3 +286,19 @@ module.exports = {
hints: false,
},
};


const loadConfig = (config) => {
const extraPath = path.resolve(process.cwd(), './config/webpack.extra.dev.js')
if (!fs.existsSync(extraPath)) {
return config;
}
const extraConfig = require(extraPath);
if (extraConfig.modifyWebpack) {
return extraConfig.modifyWebpack(config);
} else {
throw new Error(`${extraPath} does not work...`);
}
}

module.exports = loadConfig(config);