forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.conf.js
72 lines (71 loc) · 1.72 KB
/
webpack.conf.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
var prebid = require('./package.json');
var StringReplacePlugin = require('string-replace-webpack-plugin');
module.exports = {
output: {
filename: 'prebid.js'
},
devtool: 'source-map',
resolve: {
modulesDirectories: ['', 'node_modules', 'src']
},
resolveLoader: {
modulesDirectories: ['loaders', 'node_modules']
},
module: {
loaders: [
{
test: /\.js$/,
include: /(src|test)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: {
presets: ['es2015']
}
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /adaptermanager.js/,
include: /(src)/,
loader: 'analyticsLoader'
},
{
test: /adaptermanager.js/,
include: /(src)/,
loader: 'adapterLoader'
},
{
test: /constants.json$/,
include: /(src)/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /%%REPO_AND_VERSION%%/g,
replacement: function (match, p1, offset, string) {
return `${prebid.repository.url.split('/')[3]}_prebid_${prebid.version}`;
}
}
]
})
},
{
test: /\.js$/,
include: /(src|test|integrationExamples)/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /\$\$PREBID_GLOBAL\$\$/g,
replacement: function (match, p1, offset, string) {
return prebid.globalVarName;
}
}
]
})
}
]
},
plugins: [
new StringReplacePlugin()
]
};