forked from segmentio/analytics.js-integrations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.tester.js
74 lines (69 loc) · 1.67 KB
/
webpack.config.tester.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
72
73
74
const { strict } = require('assert');
var path = require('path');
var fs = require('fs-extra');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin;
var files = fs.readdirSync('./integrations');
var entries = {};
files.forEach(function(file) {
var filePath = './integrations/' + file + '/lib/index.js';
if (!fs.existsSync(filePath)) {
filePath = './integrations/' + file + '/lib/index.ts';
if (!fs.existsSync(filePath)) {
return;
}
}
entries[file] = filePath;
});
var plugins = [];
module.exports = {
entry: entries,
mode: 'development',
devtool: 'eval-source-map',
output: {
filename: '[name]/latest/[name].dynamic.js.gz',
chunkFilename: 'vendor/[name].[contenthash].js.gz',
path: path.resolve(__dirname, 'tester/dist/next-integrations/integrations'),
library: '[name]Integration',
libraryTarget: 'window'
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
targets: {
ie: '11'
}
}
]
]
}
}
}
]
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
domify: '/node_modules/domify/index.js',
'@segment/analytics.js-integration':
'/node_modules/@segment/analytics.js-integration'
}
},
devServer: {
contentBase: path.resolve(__dirname, 'build')
},
optimization: {
moduleIds: 'hashed',
minimize: false
},
plugins: plugins
};