-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add file extension when using
absoluteRuntime
(#12827)
* fix: add file extention when the absolute path to the runtime files are 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. * Update deps * Fix imports resolution * Update fixtures (Windows) Co-authored-by: Nicolò Ribaudo <[email protected]> Co-authored-by: Babel Bot <[email protected]>
- Loading branch information
1 parent
d16f811
commit d3fffd9
Showing
17 changed files
with
110 additions
and
44 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
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
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
4 changes: 4 additions & 0 deletions
4
packages/babel-plugin-transform-runtime/src/get-runtime-path/browser.ts
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
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
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
1 change: 1 addition & 0 deletions
1
.../absoluteRuntime/relative/subfolder/node_modules/@babel/runtime/helpers/classCallCheck.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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