Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Last active October 23, 2019 23:40
Show Gist options
  • Select an option

  • Save harrisonmalone/5a1b576721a4d0a44be86853e351adf2 to your computer and use it in GitHub Desktop.

Select an option

Save harrisonmalone/5a1b576721a4d0a44be86853e351adf2 to your computer and use it in GitHub Desktop.
this was my webpack config for a webpack react deployment, theres an index.html in build and in the root directory, i think one of them is automatically created
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
entry: './src/App.js',
output: {
path: path.resolve(__dirname, 'build'),
publicPath: '/',
filename: 'bundle.js'
},
devServer: {
contentBase: "./build",
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve('./index.html'),
}),
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-react', {
'plugins': [
'@babel/plugin-proposal-class-properties']
}
]
}
}
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment