Skip to content

Instantly share code, notes, and snippets.

@SherryH
Created April 30, 2018 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SherryH/486168b0452b833b4138209291357497 to your computer and use it in GitHub Desktop.
Save SherryH/486168b0452b833b4138209291357497 to your computer and use it in GitHub Desktop.
// Dynamic name generation
const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: { main: path.join(__dirname, './src/index.js') },
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/assets',
filename: '[name].[chunkhash:4].js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'Form Builder',
template: path.join(__dirname, '/static/template.html')
}),
new CleanWebpackPlugin(['dist'])
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment