-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
47 lines (43 loc) · 1.4 KB
/
webpack.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
var path = require('path')
var webpack = require('webpack')
var nodeConfig = {
target: 'node',
node: { process: false },
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
]
}
module.exports = [
// Node specific Builds (to be used on server side environment)
// CommonJS is the Package Default. If you want to use other build,
// just specify on your webpack configuration as an Alias
createConfig('commonjs2', 'commonjs2.node', nodeConfig),
createConfig('umd', 'umd.node', nodeConfig),
createConfig('amd', 'amd.node', nodeConfig),
// Other Browser Builds (using umd, amd or commonjs2 modules)
createConfig('commonjs2', 'commonjs2.browser'),
createConfig('umd', 'umd.browser'),
createConfig('amd', 'amd.browser'),
// Finally, the Global Variable Build - Always a Browser build
createConfig('var', 'var')
]
function createConfig (libraryTarget, filename, config = {}) {
return Object.assign({}, {
entry: './src/index.js',
output: {
filename: 'monolythic.' + filename + '.js',
library: 'monolythic',
libraryTarget: libraryTarget
},
mode: 'development',
resolve: {
alias: {
'@modules': path.resolve(__dirname, 'src/modules'),
'@models': path.resolve(__dirname, 'src/models'),
'@facades': path.resolve(__dirname, 'src/models/facades')
}
}
}, config)
}