forked from userdive/agent.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
62 lines (57 loc) · 1.67 KB
/
webpack.config.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import * as path from 'path'
import * as TerserPlugin from 'terser-webpack-plugin'
import { BannerPlugin, Configuration, DefinePlugin } from 'webpack'
import { version } from './lerna.json'
import { author, license } from './package.json'
const date = new Date()
const config: Configuration = {
entry: {
'agent.d': path.join(__dirname, 'packages/agent/src/entrypoint/debug.ts'),
agent: path.join(__dirname, 'packages/agent/src/entrypoint/index.ts'),
linker: path.join(__dirname, 'packages/linker/src/index.ts'),
'kaizenplatform-plugin': path.join(
__dirname,
'packages/kaizenplatform/src/index.ts'
),
'vwo-plugin': path.join(__dirname, 'packages/vwo/src/index.ts'),
'optimizely-x-plugin': path.join(
__dirname,
'packages/optimizely_x/src/index.ts'
),
},
output: {
path: path.join(__dirname, 'cdn'),
filename: '[name].js',
sourceMapFilename: '[name].js.map',
},
optimization: {
minimizer: [
new TerserPlugin({
sourceMap: true,
terserOptions: {
output: {
comments: false,
},
},
}),
new BannerPlugin({
banner: `@userdive/[name] ${version} | Copyright (c) ${date.getFullYear()} ${author} | License ${license}`,
}),
],
concatenateModules: true,
},
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [{ test: /\.ts$/, loader: 'ts-loader' }],
},
plugins: [
new DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.VERSION': JSON.stringify(version),
'process.env.RAVEN_DSN': JSON.stringify(process.env.RAVEN_DSN),
}),
],
}
export default config