karma-6to5-preprocessor

3.0.1 • Public • Published

npm version npm downloads

karma-6to5-preprocessor

Preprocessor to compile ES6 on the fly with 6to5.

Installation

npm install karma-6to5-preprocessor --save-dev

Configuration

See 6to5 options for more details.

Given options properties are passed to 6to5.

In addition to the options property, you can configure the following options with functions because they may differ from file to file.

  • filename
  • sourceRoot
  • sourceMapName
  • sourceFileName

For example, inline sourcemap configuration would look like the following.

module.exports = function(config) {
  config.set({
    files: [
      'src/**/*.js',
      'test/**/*.js'
    ],
    preprocessors: {
      'src/**/*.js': ['6to5'],
      'test/**/*.js': ['6to5']
    },
    '6to5Preprocessor': {
      options: {
        sourceMap: 'inline'
      },
      filename: function(file) {
        return file.originalPath.replace(/\.js$/, '.es5.js');
      },
      sourceFileName: function(file) {
        return file.originalPath;
      }
    }
  });
};

Package Sidebar

Install

npm i karma-6to5-preprocessor

Weekly Downloads

0

Version

3.0.1

License

ISC

Last publish

Collaborators

  • shuhei
  • thejameskyle