-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
56 lines (51 loc) · 1.44 KB
/
Copy pathwebpack.config.js
File metadata and controls
56 lines (51 loc) · 1.44 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
56
var webpack = require("webpack");
//var PROD = ((JSON.parse(process.env['NODE_ENV']) == 'production') || process.argv.indexOf('--production') !== -1);
//var QA = ((JSON.parse(process.env['NODE_ENV']) == 'qa') || process.argv.indexOf('--qa') !== -1);
var PROD = (process.argv.indexOf('--production') !== -1);
var QA = (process.argv.indexOf('--qa') !== -1);
var entry = [];
var devtool = "#source-map";
var plugins = [];
var outputFile = "build/app.js";
if (PROD) {
entry = './entry/production.ts';
devtool = '';
plugins = [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
mangle: false
})
];
}
else if (QA) {
entry.push('./entry/qa.ts');
}
else {
entry.push('./entry/development.ts');
}
module.exports = {
entry: entry,
devtool: devtool,
output: {
path: __dirname,
filename: outputFile
},
resolve: {
modulesDirectories: ['node_modules', 'bower_components']
},
module: {
loaders: [
{ test: /\.ts$/, exclude: [/node_modules/, /bower_components/], loader: "ts-loader"},
{ test: /\.css$/, loader: "text-loader" },
{ test: /\.less$/, loader: "style!css!less" },
{ test: /\.(woff|svg|ttf|eot|otf)([\?]?.*)$/, loader: "file-loader?name=fonts/[name].[ext]" },
{ test: /\.json$/, loader: "json-loader" },
{ test: /\.html$/, loader: "text-loader" }
]
},
plugins: plugins
};