forked from squirrellyjs/squirrelly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (42 loc) · 1.19 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
var path = require('path')
var webpack = require('webpack')
module.exports = env => {
// console.log('Production: ', (env.production||"undefined")); // true
// console.log('Target: ' + (env.target||"undefined"));
var fileName
if (env && env.target && env.target === 'browser') {
console.log('Compiling')
if (env.production) {
fileName = 'squirrelly.runtime.js'
} else {
fileName = 'squirrelly.runtime.dev.js'
}
} else {
if (env && env.production) {
fileName = 'squirrelly.min.js'
} else {
fileName = 'squirrelly.dev.js'
}
}
return {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: fileName,
library: 'Sqrl',
libraryTarget: 'umd',
globalObject: "typeof self !== 'undefined' ? self : this"
},
devServer: {
contentBase: path.join(__dirname, '')
},
devtool: 'sourcemap',
mode: (env && env.production) ? 'production' : 'development',
plugins: [
new webpack.DefinePlugin({
RUNTIME: ((env && env.target === 'browser')) ? JSON.stringify(true) : JSON.stringify(false),
PRODUCTION: !!((env && env.production))
})
]
}
}