-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
55 lines (51 loc) · 1.47 KB
/
Copy pathwebpack.config.js
File metadata and controls
55 lines (51 loc) · 1.47 KB
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
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
var PROD = (process.env.NODE_ENV === 'production')
module.exports = {
devtool: 'source-map',
context: path.resolve(__dirname, 'src'),
entry: {
// css: ['./main.less'],
index: ['./main.ts', './main.less']
},
output: {
path: path.join(__dirname, 'public'),
filename: 'lib/[name].[chunkhash].' + (PROD ? 'bundle.min.js' : 'bundle.js')
},
resolve: {
extensions: ['', '.ts', '.js']
},
module: {
loaders: [
{
test: /\.less$/,
loaders: ['style-loader', 'css-loader', 'less-loader']
},
{
test: /\.ts$/,
loaders: ['ng-annotate', 'ts'],
exclude: /node_modules/
},
{
test: /\.html$/,
loader: 'ngtemplate?relativeTo=/src/!html',
exclude: /index\.html/
},
{
test: /\.(jpe|jpg|woff|woff2|eot|ttf|svg)(\?.*$|$)/,
loader: 'url-loader?limit=30000&name=fonts/[name]-[hash].[ext]'
}
],
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './index.html'
})
].concat(PROD ? [
new webpack.optimize.UglifyJsPlugin({
compress: {warnings: false}
})
] : [])
}