-
Notifications
You must be signed in to change notification settings - Fork 89
/
webpack.config.js
65 lines (56 loc) · 1.37 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
const { shenanigans } = require("./package.json");
const { loading = {} } = shenanigans;
const getEntriesAndSources = () => {
return (
loading.entries || [
{
entry: `./lib/index.js`,
name: loading.name || shenanigans.name,
},
]
);
};
const getExternals = () => {
const output = {};
if (loading.externals === undefined) {
return output;
}
for (const external of loading.externals) {
output[external.name] = external.name;
}
return output;
};
const entriesAndSources = getEntriesAndSources();
const externals = getExternals();
const entry = {};
for (const pair of entriesAndSources) {
entry[pair.name] = pair.entry;
}
module.exports = {
entry,
externals,
mode: "production",
module: {
rules: [
{
test: /\.(tsx?)|(jsx?)$/,
exclude: /node_modules/,
use: {
loader: require.resolve("babel-loader"),
options: {
rootMode: "upward-optional",
},
},
},
],
},
output: {
filename: `[name].js`,
libraryTarget: "amd",
publicPath: "dist/",
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
symlinks: true,
},
};