Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add file extention when the absolute path to the runtime files a…
…re used (#12824) the es module imports need the file extention (e.g. import "@babel/runtime/helpers/jsx.js", Or the filenames being listed in the package.json's subpath exports (e.g. "import "@babel/runtime/helpers/jsx" + pkg: "./helpers/jsx": "./helpers/jsx.js"). when the user passes a path via `absoluteRuntime` then the rendered require staemnts is not the module name + subpath which will be resolved via pkg.json but rather the absolute path to the file. for this case, add the file extention / index.js to prevent bundlers from raising a warning.
- Loading branch information
Showing
9 changed files
with
20 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/relative/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...l-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-corejs3-proposals/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...abel-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-corejs3-stable/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-use-es-modules/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class Foo {} |
6 changes: 6 additions & 0 deletions
6
...l-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-use-es-modules/options.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugins": [ | ||
"transform-classes", | ||
["transform-runtime", { "absoluteRuntime": true, "useESModules": true }] | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
...abel-plugin-transform-runtime/test/fixtures/absoluteRuntime/true-use-es-modules/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var _classCallCheck = require("<CWD>/packages/babel-runtime/helpers/classCallCheck.js"); | ||
|
||
let Foo = function Foo() { | ||
"use strict"; | ||
|
||
_classCallCheck(this, Foo); | ||
}; |
2 changes: 1 addition & 1 deletion
2
packages/babel-plugin-transform-runtime/test/fixtures/absoluteRuntime/true/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/babel-plugin-transform-runtime/test/fixtures/windows/absoluteRuntime/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters