-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
41 lines (34 loc) · 1.01 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
const path = require('path')
const packageJson = require('./package.json')
// production config minimizes the code
const productionConfig = {
mode: 'production',
// application entry point
entry: './lib/index.js',
// Output configuration
output: {
path: path.resolve(__dirname, 'lib'),
filename: `sqlitecloud.drivers.js`,
library: 'sqlitecloud',
libraryTarget: 'umd',
globalObject: 'this'
},
optimization: {
minimize: true
},
// add mock 'net' module
// add mock 'tls' module
resolve: {
fallback: {
net: false, // tell Webpack to ignore "net"
tls: false // tell Webpack to ignore "tls"
}
}
}
// development config does not minimize the code
const devConfig = JSON.parse(JSON.stringify(productionConfig))
devConfig.mode = 'development'
devConfig.optimization.minimize = false
devConfig.output.filename = `sqlitecloud.drivers.dev.js`
// devConfig.output.filename = `sqlitecloud.v${packageJson.version}.dev.js`
module.exports = [productionConfig, devConfig]