Skip to content

Commit a5b0c07

Browse files
committed
Remove dependency on node:module
Should allow this package to be used in non-node environments. Resolves #20
1 parent cf22508 commit a5b0c07

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import type * as Babel from "@babel/core";
22
import type { types as t, NodePath } from "@babel/core";
3-
import { createRequire } from "node:module";
43
import { ImportUtil } from "babel-import-util";
54
import { globalId } from "./global-id.ts";
6-
const req = createRequire(import.meta.url);
7-
const { default: decoratorSyntax } = req("@babel/plugin-syntax-decorators");
5+
6+
// @ts-expect-error no upstream types
7+
import PluginSyntaxDecorators from "@babel/plugin-syntax-decorators";
8+
const decoratorSyntax =
9+
PluginSyntaxDecorators.default || PluginSyntaxDecorators;
810

911
interface State extends Babel.PluginPass {
1012
currentClassBodies: t.ClassBody[];

0 commit comments

Comments
 (0)