提交 | 用户 | age
|
07c18d
|
1 |
// TODO |
a89eee
|
2 |
import type { GetManualChunk } from 'rollup'; |
4cca00
|
3 |
|
V |
4 |
// |
|
5 |
const vendorLibs: { match: string[]; output: string }[] = [ |
3509eb
|
6 |
// { |
V |
7 |
// match: ['xlsx'], |
|
8 |
// output: 'xlsx', |
|
9 |
// }, |
4cca00
|
10 |
]; |
V |
11 |
|
|
12 |
// @ts-ignore |
a89eee
|
13 |
export const configManualChunk: GetManualChunk = (id: string) => { |
4cca00
|
14 |
if (/[\\/]node_modules[\\/]/.test(id)) { |
V |
15 |
const matchItem = vendorLibs.find((item) => { |
|
16 |
const reg = new RegExp(`[\\/]node_modules[\\/]_?(${item.match.join('|')})(.*)`, 'ig'); |
|
17 |
return reg.test(id); |
|
18 |
}); |
|
19 |
return matchItem ? matchItem.output : null; |
|
20 |
} |
|
21 |
}; |