Skip to content

Instantly share code, notes, and snippets.

@ryoldash
Last active October 29, 2018 16:52
Show Gist options
  • Save ryoldash/da02a860445a6bfabbe11b6b02d1c72b to your computer and use it in GitHub Desktop.
Save ryoldash/da02a860445a6bfabbe11b6b02d1c72b to your computer and use it in GitHub Desktop.
Customize webpack configuration of React App created with Create-react-app
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
entry: {
main: './src/index.js'
},
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [
'file-loader'
]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
'file-loader'
]
}
]
},
plugins: [ new CopyWebpackPlugin([{from: './src/lib/legacyLib.js'}])]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment