Improve webpack configuration.

This commit is contained in:
Alexis Lahouze 2017-10-09 08:21:48 +02:00
parent 1a5f886810
commit c53f917374

View File

@ -5,7 +5,14 @@ const webpack = require('webpack');
module.exports = { module.exports = {
context: path.resolve(__dirname, 'src'), context: path.resolve(__dirname, 'src'),
entry: './main.ts', entry: {
"main": [
'./main.ts'
],
"styles": [
'./main.scss'
]
},
devtool: 'source-map', devtool: 'source-map',
resolve: { resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.html'], extensions: ['.js', '.jsx', '.ts', '.tsx', '.html'],
@ -92,9 +99,6 @@ module.exports = {
}] }]
}, },
plugins: [ plugins: [
new HtmlWebpackPlugin({
title: 'Accountant',
template: 'index.ejs'
}), }),
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
"window.jQuery": "jquery" "window.jQuery": "jquery"
@ -102,11 +106,21 @@ module.exports = {
new webpack.ContextReplacementPlugin( new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/, /angular(\\|\/)core(\\|\/)@angular/,
path.resolve(__dirname, './') path.resolve(__dirname, './')
) ),
new HtmlWebpackPlugin({
title: 'Accountant',
template: 'index.ejs',
hash: false,
inject: true,
compile: true,
minify: false,
chunks: 'all'
})
], ],
output: { output: {
path: path.resolve(__dirname, 'build'), path: path.resolve(__dirname, 'build'),
filename: 'js/bundle.js', filename: '[name].bundle.js',
chunkFilename: '[name].chunk.js'
//publicPath: 'js' //publicPath: 'js'
}, },
devServer: { devServer: {