Skip to content

Commit

Permalink
fix: use file extension for regenerator import in `@babel/plugin-tran…
Browse files Browse the repository at this point in the history
…sform-runtime` when inserting import to an absolute path
  • Loading branch information
charlessuh committed Nov 10, 2021
1 parent 74bec41 commit 6cf52b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/babel-plugin-transform-runtime/src/index.ts
Expand Up @@ -165,7 +165,7 @@ export default declare((api, options, dirname) => {
};
}

const corejsExt = absoluteRuntime ? ".js" : "";
const ext = absoluteRuntime ? ".js" : "";

return {
name: "transform-runtime",
Expand All @@ -178,7 +178,7 @@ export default declare((api, options, dirname) => {
[pluginsCompat]: {
runtimeVersion,
useBabelRuntime: modulePath,
ext: corejsExt,
ext,
},
},
createRegeneratorPlugin({
Expand All @@ -193,7 +193,7 @@ export default declare((api, options, dirname) => {
method: "usage-pure",
version: 3,
proposals,
[pluginsCompat]: { useBabelRuntime: modulePath, ext: corejsExt },
[pluginsCompat]: { useBabelRuntime: modulePath, ext },
},
createRegeneratorPlugin({
method: "usage-pure",
Expand Down Expand Up @@ -233,7 +233,7 @@ export default declare((api, options, dirname) => {
: "helpers";

return addDefaultImport(
`${modulePath}/${helpersDir}/${name}`,
`${modulePath}/${helpersDir}/${name}${ext}`,
name,
blockHoist,
true,
Expand Down

0 comments on commit 6cf52b5

Please sign in to comment.