Skip to content

babel-register compiles .js files; should only handle .babel.js #39

Closed
@cspotcode

Description

Babel frequently has bugs (at least, I've hit many) so there's no reason to have babel compiling .js files when it's not necessary.

You can use babel-register's only option to avoid transpiling files unless they actually end in .babel.js
https://github.com/js-cli/js-interpret/blob/master/index.js#L2-L12

'.babel.js': [
    {
      module: 'babel-register',
      register: function (module) {
        module({
          // register on .js extension due to https://github.com/joyent/node/blob/v0.12.0/lib/module.js#L353
          // which only captures the final extension (.babel.js -> .js)
          extensions: '.js',
          only: /\.babel\.js$/
        });
      }
    },
    // ... do the same for other entries in this array

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