-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.config.js
113 lines (112 loc) · 3.72 KB
/
webpack.dev.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
var path = require('path');
var webpack = require('webpack');
var DefinePlugin = require('webpack/lib/DefinePlugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
var ProgressBarPlugin = require('progress-bar-webpack-plugin');
module.exports = {
entry: {
bootstrap: [__dirname + '/src/main/webapp/bootstrap.ts', 'webpack-hot-middleware/client?reload=true'],
polyfill: ['zone.js/dist/zone', 'reflect-metadata'],
thirdparty: ['jquery', 'flatpickr', 'echarts']
},
output: {
path: path.join(__dirname, 'build', 'client'),
filename: 'js/[name].js',
chunkFilename: 'js/chunk-[id].js',
publicPath: 'http://localhost:9000/'
},
module: {
loaders: [
{
test: /\.ts$/,
loader: [
'@angularclass/hmr-loader',
'awesome-typescript-loader',
'angular2-template-loader',
'angular2-router-loader'
]
}, {
test: /\.html$/,
loader: 'html-loader',
include: path.join(__dirname, 'src/main/')
}, {
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
query: {
name: 'images/[name].[ext]',
limit: 100
}
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
}, {
test: /\.scss$/,
exclude: [
path.join(__dirname, 'src/main/webapp/app')
],
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader!sass-loader' })
}, {
test: /\.scss$/,
include: [
path.join(__dirname, 'src/main/webapp/app')
],
loaders: [
'to-string-loader',
'css-loader',
'sass-loader'
]
}, {
test: /\.ejs$/,
loader: 'ejs-loader'
}, {
test: /jquery/,
use: [{
loader: 'expose-loader',
options: 'jQuery'
}, {
loader: 'expose-loader',
options: '$'
}]
}
]
},
resolve: {
extensions: ['.ts', '.js']
},
plugins: [
new ProgressBarPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new DefinePlugin({
'ENV': '"dev"'
}),
new ExtractTextPlugin('css/[name].css'),
new HtmlWebpackPlugin({
filename: 'index.html',
template: __dirname + '/src/main/webapp/index.ejs'
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
Flatpickr: 'flatpickr',
echarts: 'echarts'
}),
new webpack.optimize.CommonsChunkPlugin({
name: [
'bootstrap',
'polyfill',
'thirdparty'
]
}),
new AddAssetHtmlPlugin([
{ filepath: require.resolve('./dll/angular.dll.js') }
]),
new webpack.DllReferencePlugin({
context: __dirname,
manifest: require(path.join(__dirname, 'dll/angular-manifest.json'))
})
],
devtool: 'source-map' //'cheap-module-source-map' | 'source-map'
}