Socket
Socket
Sign inDemoInstall

babel-loader-exclude-node-modules-except

Package Overview
Dependencies
1
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-loader-exclude-node-modules-except

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


Version published
Weekly downloads
11K
increased by7.81%
Maintainers
1
Install size
10.3 kB
Created
Weekly downloads
 

Readme

Source

babel-loader-exclude-node-modules-except

license npm npm Tests

StatementsBranchesFunctionsLines
StatementsBranchesFunctionsLines

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'
        }
      }
    ]
  }
};

Also, wildcards for matching are allowed, except names

Since v1.2.0

// webpack.config.js

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

module.exports = {
  // config properties
  // ...
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: babelLoaderExcludeNodeModulesExcept([
          'react-*',
          '@awesomecorp/*'
        ]),
        use: {
          loader: 'babel-loader'
        }
      }
    ]
  }
};


Contributors 💪

License

MIT License


Keywords

FAQs

Last updated on 31 May 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc