react-app-rewired-preact
Version:
Tweak the create-react-app webpack config(s) without using 'eject' and without creating a fork of the react-scripts
19 lines (15 loc) • 793 B
JavaScript
process.env.NODE_ENV = process.env.NODE_ENV || "development";
const paths = require("./utils/paths");
const overrides = require('../config-overrides');
const webpackConfigPath = paths.scriptVersion + "/config/webpack.config.dev";
const devServerConfigPath = paths.scriptVersion + "/config/webpackDevServer.config.js";
// load original configs
const webpackConfig = require(webpackConfigPath);
const devServerConfig = require(devServerConfigPath);
// override config in memory
require.cache[require.resolve(webpackConfigPath)].exports =
overrides.webpack(webpackConfig, process.env.NODE_ENV);
require.cache[require.resolve(devServerConfigPath)].exports =
overrides.devServer(devServerConfig, process.env.NODE_ENV);
// run original script
require(paths.scriptVersion + "/scripts/start");