🐛: 更新layer babel配置,修复regeneratorRuntime is not defined

This commit is contained in:
0o张不歪o0 2022-06-25 17:52:06 +08:00
parent aaa072db12
commit d18425cb2a
2 changed files with 13 additions and 5 deletions

View File

@ -31,5 +31,8 @@
"current node", "current node",
"last 2 versions and > 2%", "last 2 versions and > 2%",
"ie > 10" "ie > 10"
] ],
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.18.5"
}
} }

View File

@ -1,6 +1,6 @@
import { defineConfig } from "vite"; import { defineConfig } from "vite";
import { name } from "./package.json"; import { name } from "./package.json";
import babel from "@rollup/plugin-babel"; import { babel } from "@rollup/plugin-babel";
import vue from "@vitejs/plugin-vue"; import vue from "@vitejs/plugin-vue";
import path from "path"; import path from "path";
@ -31,11 +31,16 @@ export default defineConfig({
assetFileNames: "index.css", assetFileNames: "index.css",
}, },
plugins: [ plugins: [
// @ts-ignore
babel({ babel({
babelHelpers: 'runtime',
exclude: "node_modules/**", exclude: "node_modules/**",
extensions: [".js", ".jsx", ".ts", ".tsx", ".vue"], extensions: [".js", ".jsx", ".ts", ".tsx", ".vue"],
presets: ["@babel/preset-env", "@babel/preset-typescript"] presets: ["@babel/preset-env", "@babel/preset-typescript"],
plugins: [
[
'@babel/plugin-transform-runtime',
],
]
}), }),
], ],
external: ["vue"], external: ["vue"],