Skip to content

Commit

Permalink
fix standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Feb 15, 2024
1 parent b36234a commit 26f3a10
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/babel-preset-flow/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { declarePreset } from "@babel/helper-plugin-utils";
import transformFlowStripTypes from "@babel/plugin-transform-flow-strip-types";
import normalizeOptions from "./normalize-options.ts";
import { createRequire } from "module";

const require = createRequire(import.meta.url);

export default declarePreset((api, opts) => {
api.assertVersion(
Expand All @@ -18,10 +15,12 @@ export default declarePreset((api, opts) => {
useHermesParser = false,
} = normalizeOptions(opts);

const plugins = [[transformFlowStripTypes, { all, allowDeclareFields }]];
const plugins: any[] = [
[transformFlowStripTypes, { all, allowDeclareFields }],
];

if (useHermesParser) {
plugins.unshift(require("babel-plugin-syntax-hermes-parser"));
plugins.unshift("babel-plugin-syntax-hermes-parser");
}

// TODO: In Babel 7, ignoreExtensions is always true.
Expand Down

0 comments on commit 26f3a10

Please sign in to comment.