-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
71 lines (69 loc) · 1.82 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
61
62
63
64
65
66
67
68
69
70
71
"use strict";
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = env => {
let filenamebase = "rxrmi", devtool = { devtool: "source-map" };
let mode = "development", full = false;
if (env && env.full) {
filenamebase += ".deps";
full = true;
}
if (env && env.production) {
filenamebase += ".min";
mode = "production";
devtool = {};
}
const filename = filenamebase + '.umd.js';
return {
...devtool,
context: path.join(__dirname, "./"),
// optimization: {
// minimize: true,
// minimizer: [
// new TerserPlugin({ parallel: true, }),
// ],
// },
entry: {
index: "./source/index.ts"
},
externals: function ({ context, request }, callback) {
const external = (root = request.split('/')) => callback(null, {
root,
commonjs: request,
commonjs2: request,
amd: request
});
if (!full && request.match(/^(altern-map|dependent-type|rx-async)$/)) return external();
if (request.match(/^rxjs(\/(operators|testing|ajax|webSocket|fetch|config|internal\/.*|)|)$/)) return external();
callback();
},
mode,
module: {
rules: [{
test: /\.ts$/,
exclude: [/deep-is\.d\.ts/],
use: {
loader: "ts-loader",
options: {
compilerOptions: { declaration: false },
configFile: "tsconfig-dist-webpack.json"
}
}
}, {
test: /deep-is\.d\.ts$/,
use: "ignore-loader"
}]
},
output: {
filename,
library: "rxrmi",
libraryTarget: "umd",
path: path.resolve(__dirname, "./bundles"),
globalObject: 'self',
},
resolve: {
extensions: [".ts", ".js"],
mainFields: ['source', 'browser', 'module', 'main'],
}
};
};