From c53f9173749120557f16883fea8028c9028e17dc Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Mon, 9 Oct 2017 08:21:48 +0200 Subject: [PATCH] Improve webpack configuration. --- webpack.config.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index a633140..74a9043 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,7 +5,14 @@ const webpack = require('webpack'); module.exports = { context: path.resolve(__dirname, 'src'), - entry: './main.ts', + entry: { + "main": [ + './main.ts' + ], + "styles": [ + './main.scss' + ] + }, devtool: 'source-map', resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx', '.html'], @@ -92,9 +99,6 @@ module.exports = { }] }, plugins: [ - new HtmlWebpackPlugin({ - title: 'Accountant', - template: 'index.ejs' }), new webpack.ProvidePlugin({ "window.jQuery": "jquery" @@ -102,11 +106,21 @@ module.exports = { new webpack.ContextReplacementPlugin( /angular(\\|\/)core(\\|\/)@angular/, path.resolve(__dirname, './') - ) + ), + new HtmlWebpackPlugin({ + title: 'Accountant', + template: 'index.ejs', + hash: false, + inject: true, + compile: true, + minify: false, + chunks: 'all' + }) ], output: { path: path.resolve(__dirname, 'build'), - filename: 'js/bundle.js', + filename: '[name].bundle.js', + chunkFilename: '[name].chunk.js' //publicPath: 'js' }, devServer: {