forked from hsbalar/preserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
60 lines (50 loc) · 1.74 KB
/
webpack.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
const webpack = require('webpack');
const production = process.env.NODE_ENV === "production";
const autoprefixer = require('autoprefixer');
const path = require("path");
const config = {
entry: {
'app': './client/app.ts',
'vendor': './client/vendor.ts'
},
debug: !production,
devtool: production ? null : "source-map",
output: {
path: "./dist",
filename: "bundle.js"
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js')
// new webpack.optimize.UglifyJsPlugin({ compressor: { warnings: false } }),
// new webpack.optimize.DedupePlugin(),
// new webpack.DefinePlugin({
// "process.env": { NODE_ENV: JSON.stringify("production") }
// })
],
resolve: {
extensions: ['', '.ts', '.js']
},
module: {
loaders: [
{ test: /\.ts$/, loader: 'ts-loader' },
{ test: /\.html$/, loader: 'raw'},
{ test: /\.scss$/, include: [ path.resolve(__dirname, 'client/app/components') ], loader: 'raw!postcss!sass' },
{ test: /\.scss$/, include: [ path.resolve(__dirname, 'client/assets') ], loader: 'style!css!postcss!sass' },
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file" }
],
noParse: [ path.join(__dirname, 'node_modules', '@angular', 'bundles') ]
},
postcss: [ autoprefixer ]
};
if (production) {
config.plugins.push(
new webpack.optimize.UglifyJsPlugin({ compressor: { warnings: false } }),
new webpack.optimize.DedupePlugin(),
new webpack.DefinePlugin({
"process.env": { NODE_ENV: JSON.stringify("production") }
}),
new webpack.NoErrorsPlugin()
);
}
module.exports = config;