Skip to content

Commit

Permalink
node 12
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Feb 15, 2024
1 parent 26f3a10 commit 8d1e507
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/babel-preset-flow/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ export default declarePreset((api, opts) => {
];

if (useHermesParser) {
if (Number.parseInt(process.versions.node, 10) < 12) {
throw new Error(
"The Hermes parser is only supported in Node 12 and later.",
);
}
if (IS_STANDALONE) {
throw new Error(
"The Hermes parser is not supported in the @babel/standalone.",
);
}
plugins.unshift("babel-plugin-syntax-hermes-parser");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"presets": [["flow", { "useHermesParser": true }]]
"presets": [["flow", { "useHermesParser": true }]],
"minNodeVersion": 12
}

0 comments on commit 8d1e507

Please sign in to comment.