-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.ts
48 lines (45 loc) · 898 Bytes
/
webpack.common.ts
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
import * as path from "path";
import { merge } from "webpack-merge";
import { Configuration, EnvironmentPlugin } from "webpack";
const config: Configuration = {
entry: "./src/index.ts",
output: {
path: path.resolve(__dirname, "dist"),
library: "analytics-plugin-profitwell",
libraryTarget: "umd",
},
module: {
rules: [
{
test: /\.ts$/,
loader: "ts-loader",
},
],
},
resolve: {
extensions: [".ts"],
},
externals: ["analytics", "analytics-utils"],
};
export const serverConfig = merge(config, {
target: "node",
output: {
filename: "lib.node.js",
},
plugins: [
new EnvironmentPlugin({
BROWSER: false,
}),
],
});
export const browserConfig = merge(config, {
target: "web",
output: {
filename: "lib.browser.js",
},
plugins: [
new EnvironmentPlugin({
BROWSER: true,
}),
],
});