Skip to content

Instantly share code, notes, and snippets.

@ryoldash
Last active December 27, 2019 10:55
Show Gist options
  • Save ryoldash/fed828b7be3877f52a407140d61361e3 to your computer and use it in GitHub Desktop.
Save ryoldash/fed828b7be3877f52a407140d61361e3 to your computer and use it in GitHub Desktop.
Customize webpack configuration of React App created with Create-react-app
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = function override(config, env) {
if (!config.plugins) {
config.plugins = [];
}
config.plugins.push(
(process.env.NODE_ENV === 'production') ?
new CopyWebpackPlugin([{from: 'src/lib/legacyLib.js'}]) :
new CopyWebpackPlugin([{from: 'src/lib/legacyLib.js', to: 'dist'}])
);
return config;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment