fix: Add babel configuration for Playwright to handle TypeScript declare fields

- Configure babel plugins for TypeScript with allowDeclareFields option
- Add module resolver for @ alias to src directory
- Create custom babel plugin to stub Vue/CSS imports
- Add browser globals polyfill using happy-dom for Node.js context
- Update playwright.i18n.config.ts with babel configuration

This enables collect-i18n tests to run with proper TypeScript and module transformations.
This commit is contained in:
snomiao
2025-09-12 08:16:37 +00:00
parent 4ec6223189
commit 540b6f3d26
8 changed files with 1475 additions and 374 deletions

24
babel.config.json Normal file
View File

@@ -0,0 +1,24 @@
{
"presets": [
"@babel/preset-env",
[
"@babel/preset-typescript",
{
"allowDeclareFields": true,
"onlyRemoveTypeImports": true
}
]
],
"plugins": [
[
"babel-plugin-module-resolver",
{
"root": ["./"],
"alias": {
"@": "./src"
}
}
],
"@vue/babel-plugin-jsx"
]
}