-
Notifications
You must be signed in to change notification settings - Fork 126
/
webpack.skpm.config.js
69 lines (67 loc) · 1.79 KB
/
webpack.skpm.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
66
67
68
69
/* eslint-disable no-param-reassign */
const path = require('path')
const webpack = require('webpack')
// used for tests
const { config: normalConfig, CORE_MODULES } = require('./webpack.config')
module.exports = (config) => {
config.externals = []
config.resolve = normalConfig.resolve
config.resolve.alias = CORE_MODULES.reduce(
(prev, k) => {
prev[k] = path.resolve(__dirname, 'core-modules/node_modules/@skpm/', k)
return prev
},
{
sketch: path.resolve(__dirname, 'Source/index.js'),
}
)
config.module = normalConfig.module
config.plugins = config.plugins.concat(normalConfig.plugins)
config.plugins.push(
// we need to polyfill them manually now that skpm doesn't and when running on Jenkins, they are not provided
new webpack.ProvidePlugin({
setTimeout: [
path.resolve(
__dirname,
'core-modules/node_modules/@skpm/timers/timeout'
),
'setTimeout',
],
clearTimeout: [
path.resolve(
__dirname,
'core-modules/node_modules/@skpm/timers/timeout'
),
'clearTimeout',
],
setImmediate: [
path.resolve(
__dirname,
'core-modules/node_modules/@skpm/timers/immediate'
),
'setImmediate',
],
clearImmediate: [
path.resolve(
__dirname,
'core-modules/node_modules/@skpm/timers/immediate'
),
'clearImmediate',
],
setInterval: [
path.resolve(
__dirname,
'core-modules/node_modules/@skpm/timers/interval'
),
'setInterval',
],
clearInterval: [
path.resolve(
__dirname,
'core-modules/node_modules/@skpm/timers/interval'
),
'clearInterval',
],
})
)
}