Skip to content

Instantly share code, notes, and snippets.

@AdamRamberg
Created July 21, 2018 16:09
Show Gist options
  • Save AdamRamberg/29e8588b4e51aeb0bb6dbc16346db29d to your computer and use it in GitHub Desktop.
Save AdamRamberg/29e8588b4e51aeb0bb6dbc16346db29d to your computer and use it in GitHub Desktop.
react-from-scratch webpack.base.js
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