Skip to content

Instantly share code, notes, and snippets.

@Juszczak
Created February 23, 2020 10:00
Show Gist options
  • Save Juszczak/64a800c0a41b600abfebbfe8f07c4fdf to your computer and use it in GitHub Desktop.
Save Juszczak/64a800c0a41b600abfebbfe8f07c4fdf to your computer and use it in GitHub Desktop.
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const isProduction = !!process.env.WEBPACK_PRODUCTION;
console.log('isProduction:', typeof isProduction);
const htmlPluginConfig = {template: './src/index.html'};
const htmlPlugin = new HtmlWebpackPlugin(htmlPluginConfig)
const copyPlugin = new CopyWebpackPlugin([{
from: './src/style.css'
}]);
module.exports = {
entry: './src/main.js',
output: {
path: __dirname + '/dist',
filename: '[name].js'
},
plugins: [htmlPlugin, copyPlugin],
mode: isProduction ? 'production' : 'development'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment