-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.js
55 lines (51 loc) · 1.27 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
const webpack = require("webpack");
const minimize = process.argv.indexOf("--optimize-minimize") !== -1;
const colors = require("colors");
if (minimize) {
console.log("Building minified version of the library".bgGreen.red);
} else {
console.log("Building non minified version of the library".bgGreen.red);
}
const packageName = "CoveoJsSearchTests";
// Fail plugin will allow the webpack ts-loader to fail correctly when the TS compilation fails.
var plugins = [];
if (minimize) {
plugins.push(
new webpack.optimize.UglifyJsPlugin({
sourceMap: true
})
);
}
module.exports = {
mode: "development",
entry: "./src/Index.ts",
output: {
path: require("path").resolve("./bin/js"),
filename: minimize ? `${packageName}.min.js` : `${packageName}.js`,
chunkFilename: minimize ? `${packageName}.min.js` : `${packageName}.js`,
libraryTarget: "umd",
library: "CoveoJsSearchTests",
publicPath: "js/",
devtoolModuleFilenameTemplate: "[resource-path]"
},
resolve: {
extensions: [".ts", ".js"]
},
devtool: "source-map",
externals: [
{
"coveo-search-ui": "Coveo"
}
],
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
options: {}
}
]
},
plugins: plugins,
bail: true
};