forked from ipfs/ipfs-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-config.js
53 lines (47 loc) · 1.18 KB
/
make-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
var createConfig = require('hjs-webpack')
module.exports = function makeConfig (isDev) {
var config = createConfig({
isDev: isDev,
in: './app/scripts/index.js',
out: './dist',
output: {
publicPath: ''
},
html: function (ctx) {
return ctx.defaultTemplate({
publicPath: ''
})
},
clearBeforeBuild: '!(locale|img|favicon.ico)'
})
// Handle js-ipfs-api
config.module.rules.push({
test: /\.js$/,
include: /node_modules\/(hoek|qs|wreck|boom|lodash-es|ipfs*|libp2p*|ipld*|multi*|promisify-es6|cid*|peer*|is-ipfs)/,
loader: 'babel-loader'
})
config.externals = {
// Needed for js-ipfs-api
net: '{}',
fs: '{}',
tls: '{}',
console: '{}',
'require-dir': '{}',
// Needed for enzyme
jsdom: 'window',
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': 'window',
'text-encoding': 'window'
}
config.resolve = {
alias: {
http: 'stream-http',
https: 'https-browserify',
sinon: 'sinon/pkg/sinon'
}
}
config.module.noParse = config.module.noParse || []
config.module.noParse.push(/node_modules\/sinon\//)
return config
}