babel-plugin-remove-import-js-extension
This Babel plugin allows you to remove .js
and .jsx
extensions from JavaScript import
statements.
Why this plugin ?
If you too are using the Google Closure Compiler to transpile ES5 to ES6, you should have noticed that it requires you to leave off the .js
entension for modules. (Sources: Here). For instance,
$ java -jar closure-compiler-v20160822.jar --language_in=ECMASCRIPT6 --js main.js --language_out=ES5
Installation
$ npm install babel-plugin-remove-import-js-extension
Example
Input
Out
Usage
.babelrc
(Recommended)
Via .babelrc
Via CLI
$ babel --plugins babel-plugin-remove-import-js-extension script.js
Via Node API
;