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
| /**
| * 增加debugger组件
| * @param option
| * @returns
| */
| export default function VitePluginDevelopmentFilter(): any {
| return {
| name: 'vite-plugin-image-filter',
| apply: 'build',
|
| transform(code, id) {
| if (code.includes('createVNode(Icon')) {
| console.info('code', code)
| }
| // const tag = 'Icon'
| // const regexWithCapture = new RegExp(
| // `<${tag}>([\\s\\S]*?)<\\/${tag}>`,
| // 'g'
| // )
|
| // if (regexWithCapture.test(code)) {
| // if (process.env.NODE_ENV === 'production') {
| // const newCode = code.replaceAll(regexWithCapture, '')
| // return newCode
| // }
| // }
| return code
| },
| }
| }
|
|