-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.cdn.js
38 lines (36 loc) · 1.02 KB
/
webpack.config.cdn.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
/* eslint @typescript-eslint/no-var-requires: 0 */
const config = require("./webpack.config.js");
const version = require("./package.json").version;
const majorVersion = parseInt(version.split(".")[0]);
if (isNaN(majorVersion)) {
throw new Error("Unable to parse version number in package.json");
}
/**
* Creates the dist that's published to 'https://js.bytescale.com/upload-widget-vue/v*'.
*/
module.exports = {
...config,
entry: "./src/index.cdn.ts",
output: {
...config.output,
filename: `v${majorVersion}.js`,
libraryTarget: "umd"
},
optimization: {}, // Re-enable optimizations (i.e. minification) for CDN bundle. (See base config.)
// Important: causes all dependencies to be bundled into one JS file.
externals: {
vue: {
root: "Vue",
commonjs: "vue",
commonjs2: "vue",
amd: "vue"
}
},
resolve: {
...config.resolve,
modules: [
// Default value (resolve relative 'node_modules' from current dir, and up the ancestors).
"node_modules"
]
}
};