Created
July 21, 2018 16:09
-
-
Save AdamRamberg/29e8588b4e51aeb0bb6dbc16346db29d to your computer and use it in GitHub Desktop.
react-from-scratch webpack.base.js
This file contains 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 path = require('path'); | |
const HtmlWebPackPlugin = require('html-webpack-plugin'); | |
const plugins = [ | |
new HtmlWebPackPlugin({ | |
inject: true, | |
template: path.join(process.cwd(), 'src/index.html'), | |
}), | |
]; | |
module.exports = options => ({ | |
mode: options.mode, | |
entry: [path.join(process.cwd(), 'src/index.js')], | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: [ | |
{ | |
loader: 'babel-loader', | |
}, | |
], | |
}, | |
], | |
}, | |
devServer: options.devServer, | |
plugins: options.plugins.concat(plugins), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment