-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.browser.js
More file actions
51 lines (49 loc) · 1.57 KB
/
webpack.browser.js
File metadata and controls
51 lines (49 loc) · 1.57 KB
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
const path = require("path")
const webpack = require("webpack")
const { merge } = require("webpack-merge")
const common = require("./webpack.common")
const { project } = require("./project")
/**
* @param {{ mode: webpack.Configuration["mode"] }} env
* @param {string[]} argv
* @returns {webpack.Configuration}
*/
module.exports = function (env, argv) {
const comments = [
"@name " + project.name,
"@author " + project.author,
"@version " + project.version,
"@license " + project.license
]
return merge(common({ ...env, comments }, argv), {
entry: {
[project.title + "-browser" + ".js"]: "./src/wrapper/kitten-cloud-function-package.ts",
[project.title + "-browser" + ".min.js"]: "./src/wrapper/kitten-cloud-function-package.ts"
},
output: {
path: path.resolve(__dirname, "dist"),
library: {
name: {
root: "KittenCloudFunction"
},
type: "umd"
}
},
externalsType: "var",
externals: {
"axios": "axios",
"diff": "diff",
"@slightning/anything-to-string": "stringify"
},
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /^(fs|os|path|websocket|appdirsjs)$/
}),
new webpack.BannerPlugin({
banner: "/**" + "\n" + comments.map(line => ` * ${line}\n`).join("") + " */" + "\n",
raw: true,
entryOnly: true
})
]
})
}