babel-loader-exclude-node-modules-except
v1.2.1
Published
Creating a regular expression for excluding node_modules from babel transpiling except for individual modules
Downloads
39,399
Maintainers
Readme
babel-loader-exclude-node-modules-except
| 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'
}
}
]
}
};
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 💪
- April Arcus @AprilArcus
- Thordur Thordarson @earthslasthope