Created
April 30, 2018 10:06
-
-
Save SherryH/486168b0452b833b4138209291357497 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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