forked from kzahel/web-server-chrome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.dev.js
91 lines (85 loc) · 2.02 KB
/
webpack.config.dev.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
var path = require('path');
var nodeModulesPath = __dirname + '/node_modules';
var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
var fs = require('fs');
var glob = require('glob');
var minimatch = require("minimatch");
function globArray(patterns, options) {
var i, list = [];
if (!Array.isArray(patterns)) {
patterns = [patterns];
}
patterns.forEach(function (pattern) {
if (pattern[0] === "!") {
i = list.length - 1;
while (i > -1) {
if (!minimatch(list[i], pattern)) {
list.splice(i, 1);
}
i--;
}
}
else {
var newList = glob.sync(pattern, options);
newList.forEach(function (item) {
if (list.indexOf(options.cwd + item) === -1) {
list.push(options.cwd + item);
}
});
}
});
return list;
}
var regExcludes = [/\.d\.ts$/];
var config = {
devtool: 'inline-source-map',
entry: {
"./": globArray(["**/*.ts", "!**/*.d.ts"], { cwd: path.resolve(__dirname) + '/' }),
},
output: {
path: path.resolve(__dirname),
filename: 'wsc-chrome.js'
},
resolve: {
// Add '.ts' and '.tsx' as a resolvable extension.
extensions: [".ts", ".tsx"]
},
module: {
/*rules: [
{
test: /\.ts$/,
enforce: "pre",
exclude: /node_modules/,
loader: "tslint-loader",
options: {
emitError: true,
outputReport: true,
configFile: 'tslint.json'
}
}
],*/
loaders: [
// all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'
{
test: /\.ts?$/,
loader: [
{ loader: "awesome-typescript-loader", options: { configFileName: path.resolve(__dirname, 'tsconfig.json') } }
],
exclude: [/node_modules/, nodeModulesPath]
}
]
},
plugins: [
/*new UglifyJSPlugin({
uglifyOptions: {
ie8: false,
ecma: 8,
output: {
comments: false,
beautify: false
}
}
}),*/
]
};
module.exports = config;