Skip to content

Instantly share code, notes, and snippets.

@navsqi
Created May 28, 2020 09:27
Show Gist options
  • Select an option

  • Save navsqi/cab19c6901eba0043ecc648fdd71fe70 to your computer and use it in GitHub Desktop.

Select an option

Save navsqi/cab19c6901eba0043ecc648fdd71fe70 to your computer and use it in GitHub Desktop.
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
// Entry
entry: './src/index.js',
// Output
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
// Mode
mode: 'production',
// Loader
module: {
rules: [
{
// CSS Loader
test: /\.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
],
},
{
// BABEL Loader
test: /\.js$/,
exclude: '/node_modules/',
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
],
},
],
},
// Plugin
plugins: [
// Plugin: HTML Webpack
new HtmlWebpackPlugin({
template: './src/template.html',
filename: 'index.html',
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment