Просмотр исходного кода

chore(build): use rolldown transform filter for trim-vapor-exports

daiwei 2 месяцев назад
Родитель
Сommit
50d9475f7e
1 измененных файлов с 8 добавлено и 6 удалено
  1. 8 6
      scripts/trim-vapor-exports.js

+ 8 - 6
scripts/trim-vapor-exports.js

@@ -21,14 +21,16 @@ export function trimVaporExportsPlugin(format, pkgName) {
     return [
       {
         name: 'trim-vapor-exports',
-        transform(code, id) {
-          if (
-            id.endsWith('runtime-core/src/index.ts') ||
-            id.endsWith('runtime-dom/src/index.ts')
-          ) {
+        transform: {
+          filter: {
+            id: {
+              include: /runtime-(core|dom)\/src\/index\.ts$/,
+            },
+          },
+          handler(code) {
             const index = code.lastIndexOf('// VAPOR ---')
             return code.slice(0, index)
-          }
+          },
         },
       },
     ]