-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes a workaround for babel/babel#8462 .
- Loading branch information
1 parent
5ae172e
commit 7185b9d
Showing
7 changed files
with
51 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict' | ||
|
||
/** | ||
* A Babel plugin that adds missing `.js` file extensions to Babel runtime | ||
* import specifiers. | ||
* @param {object} babel Current Babel object. | ||
* @returns {object} Babel plugin object. | ||
* @see [babel/babel#8462](https://github.com/babel/babel/issues/8462). | ||
* @ignore | ||
*/ | ||
module.exports = function babelPluginAddBabelRuntimeFileExtensions({ types }) { | ||
return { | ||
visitor: { | ||
'ImportDeclaration|ExportNamedDeclaration'(path) { | ||
if ( | ||
path.node.source && | ||
path.node.source.value.startsWith('@babel/runtime/helpers/') && | ||
!path.node.source.value.endsWith('.js') | ||
) | ||
path | ||
.get('source') | ||
.replaceWith(types.stringLiteral(`${path.node.source.value}.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
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