/babel-loader-exclude-node-modules-except

Creating a regular expression for excluding node modules from transpiling except for individual modules

Primary LanguageJavaScriptMIT LicenseMIT

babel-loader-exclude-node-modules-except

license npm npm Tests

Statements Branches Functions Lines
Statements Branches Functions Lines

Creating a regular expression for excluding node_modules
from babel transpiling except for individual modules

Usage

// webpack.config.js

const babelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except');

module.exports = {
  // config properties
  // ...
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: babelLoaderExcludeNodeModulesExcept([
          // es6 modules from node_modules/
          'custom-jquery-methods',
          'swiper',
          'dom7'
        ]),
        use: {
          loader: 'babel-loader'
        }
      }
    ]
  }
};

Contributors 💪


License

MIT License