Last active
December 27, 2019 10:55
-
-
Save ryoldash/fed828b7be3877f52a407140d61361e3 to your computer and use it in GitHub Desktop.
Customize webpack configuration of React App created with Create-react-app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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