-
Notifications
You must be signed in to change notification settings - Fork 5
/
make-config.js
65 lines (56 loc) · 1.41 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
54
55
56
57
58
59
60
61
62
63
64
65
'use strict'
const createConfig = require('hjs-webpack')
const path = require('path')
module.exports = function makeConfig (isDev) {
const config = createConfig({
isDev: isDev,
in: './app/scripts/index.js',
out: './dist',
output: {
publicPath: ''
},
html: function (ctx) {
return ctx.defaultTemplate({
publicPath: ''
})
},
clearBeforeBuild: '!(img|favicon.ico)'
})
// Handle js-ipfs-api
config.module.loaders.push({
test: /\.js$/,
include: /node_modules\/(hoek|qs|wreck|boom|ipfs|lodash-es|promisify-es|orbit|logplease|crdts)/,
loader: 'babel-loader'
})
config.module.postLoaders = config.module.postLoaders || []
config.module.postLoaders.push({
include: /ipfs/,
test: /\.js$/,
loader: 'transform?brfs'
})
config.externals = {
// Needed for js-ipfs-api
net: '{}',
fs: '{}',
tls: '{}',
console: '{}',
mkdirp: '{}',
'require-dir': '{}'
}
config.node = config.node || {}
config.node.Buffer = require.resolve('buffer')
config.resolve = {
alias: {
http: 'stream-http',
https: 'https-browserify',
sinon: 'sinon/pkg/sinon',
'libp2p-ipfs': 'libp2p-ipfs-browser',
'node-forge': path.resolve(
path.dirname(require.resolve('libp2p-crypto')),
'../vendor/forge.bundle.js'
)
}
}
config.module.noParse = config.module.noParse || []
return config
}