Skip to content

Instantly share code, notes, and snippets.

@iampavangandhi
Created April 26, 2021 04:38
Show Gist options
  • Save iampavangandhi/b403ecb45d75d81fc28c2e6b71f9d60e to your computer and use it in GitHub Desktop.
Save iampavangandhi/b403ecb45d75d81fc28c2e6b71f9d60e to your computer and use it in GitHub Desktop.
Config file for webpack crash course tutorial on youtube, 2021
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './app/index.js',
module: {
rules: [
{
test: /\.svg$/,
use: 'svg-inline-loader',
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(js)$/,
use: 'babel-loader',
},
],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
plugins: [
new HtmlWebpackPlugin({
template: './app/index.html',
}),
],
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment