-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
64 lines (63 loc) · 1.5 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* eslint @typescript-eslint/no-var-requires: 0 */
const nodeExternals = require("webpack-node-externals");
const path = require("path");
const src = path.resolve(__dirname, "src");
const { VueLoaderPlugin } = require("vue-loader");
/**
* Creates the dist that's published to NPM.
*/
module.exports = {
output: {
libraryTarget: "commonjs2"
},
cache: false,
mode: "production",
optimization: {
// Packages on NPM shouldn't be minimized.
minimize: false,
// Several options to make the generated code a little easier to read (for debugging).
chunkIds: "named",
moduleIds: "named",
mangleExports: false
},
target: "browserslist",
entry: "./src/index.ts",
plugins: [new VueLoaderPlugin()],
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx"],
alias: {
// Remember to keep in sync with `tsconfig.json`
"@bytescale/upload-widget-vue": path.resolve(__dirname, "src")
}
},
externals: nodeExternals(),
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: "babel-loader" // Options are in 'babel.config.js'
},
{
loader: "ts-loader",
options: {
configFile: "tsconfig.build.json",
appendTsSuffixTo: [/\.vue$/]
}
}
],
include: [src]
},
{
test: /\.vue$/,
use: [
{
loader: "vue-loader"
}
],
include: [src]
}
]
}
};