gulp-babel
gulp-babel copied to clipboard
Do not change the original file extension
DISCLAIMER: I know that this issue has already been proposed and rejected different times.
gulp-babel
always renames the file to .js
, regardless of the input extension. This was the most reasonable behavior until a few years ago: .js
was the only extension for JavaScript.
However, now there are three "official" (supported by Node.js) JavaScript extensions:
-
.js
-
.cjs
-
.mjs
and renaming them to .js
is undesirable, since they are not interchangeable. I think that this is a good reason to reopen the discussion, and we have two options:
- Add a
keepFileExtensions
option, that matches@babel/cli
's--keep-file-extensions
- (breaking) Do not support changing the extension, and let users use
gulp-rename
I am aware that there is the gulp-revert-path
plugin that undoes Babel's extension change, but it is a workaround and not a proper solution: while a workaround made sense when .js
was the only reasonable extension, I think we need a real solution now.
Context: https://github.com/babel/babel/pull/12820