-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
44 lines (41 loc) · 1.29 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
const path = require('path');
var config = {
mode: 'development',
entry: './src/main.js',
output: {
hashFunction: "sha256",
filename: 'jsColorEngine.js',
path: path.resolve(__dirname, './package'),
libraryTarget: 'umd'
},
externals: {
fs: "commonjs fs",
path: "commonjs path",
utils: "commonjs utils",
},
externalsPresets: {
node: true,
},
}
module.exports = (env, argv) => {
if (argv.mode === 'development') {
config.devtool = 'source-map';
config.output.path = path.resolve(__dirname, './dev')
if (env && env.TARGET_WEB) {
config.output.libraryTarget = 'var';
config.output.library = 'jsColorEngine';
config.output.filename = 'jsColorEngineWeb.js';
config.output.path = path.resolve(__dirname, './browser-dev');
}
}
if (argv.mode === 'production') {
config.output.path = path.resolve(__dirname, './build')
if (env && env.TARGET_WEB) {
config.output.libraryTarget = 'var';
config.output.library = 'jsColorEngine';
config.output.filename = 'jsColorEngineWeb.js';
config.output.path = path.resolve(__dirname, './browser');
}
}
return config;
};