Skip to content

Do not change the original file extension #211

Open
@nicolo-ribaudo

Description

@nicolo-ribaudo

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:

  1. Add a keepFileExtensions option, that matches @babel/cli's --keep-file-extensions
  2. (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: babel/babel#12820

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions