Skip to content

Commit

Permalink
fix(babel-plugin-transform-vite-meta-glob): it should use import inst…
Browse files Browse the repository at this point in the history
…ead of require
  • Loading branch information
ArnaudWeyts committed Oct 10, 2024
1 parent 43cbc64 commit 959bdf1
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/babel-plugin-transform-vite-meta-glob/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,7 @@ export default function viteMetaGlobBabelPlugin({

const imports = globPaths.map((globPath, idx) => {
const modulePath = t.stringLiteral(globPath)
return t.variableDeclaration('const', [
t.variableDeclarator(
identifiers[idx],
t.callExpression(t.identifier('require'), [modulePath])
)
])
return t.importDeclaration([t.importDefaultSpecifier(identifiers[idx])], modulePath)
})

const variable = t.variableDeclaration('const', [
Expand Down

0 comments on commit 959bdf1

Please sign in to comment.