-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathvue-pack.config.ts
67 lines (63 loc) · 1.32 KB
/
vue-pack.config.ts
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
65
66
67
import { Configuration, nodeExternals } from '@gluons/vue-pack';
import banner from '@gluons/vue-pack-banner-plugin';
import copy from '@gluons/vue-pack-copy-plugin';
import splitChunks from '@gluons/vue-pack-splitchunks-plugin';
import { resolve } from 'path';
import bannerStr from './config/banner';
const webSplitChunks = {
cacheGroups: {
db: {
name: 'db',
test: /db\.json$/,
chunks: 'all',
enforce: true
},
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true
}
}
};
const config: Configuration = {
entry: resolve(__dirname, './src/index.ts'),
libraryName: 'VueThailandAddress',
outDir: resolve(__dirname, './dist'),
alias: {
$style: resolve(__dirname, './src/style/')
},
externals: {
module: [
nodeExternals({
allowlist: [
'vue-class-component',
'vue-property-decorator'
]
}),
(_, request, callback) => {
if (/data\/db\.json$/.test(request)) {
return callback(null, 'commonjs ./db.json');
}
callback(void 0, void 0);
}
]
},
plugins: [
banner(bannerStr),
splitChunks({
tapWeb: () => webSplitChunks
}),
copy([
{
context: resolve(__dirname, './src/data/'),
from: 'db.json'
}
])
],
dev: {
entry: resolve(__dirname, './dev/main.ts'),
htmlTitle: 'Vue Thailand Address'
}
};
export default config;