https://github.com/olehdutchenko/babel-loader-exclude-node-modules-except
Creating a regular expression for excluding node modules from transpiling except for individual modules
https://github.com/olehdutchenko/babel-loader-exclude-node-modules-except
babel-loader es6-modules exclude js-tiny-module node-modules webpack
Last synced: 4 months ago
JSON representation
Creating a regular expression for excluding node modules from transpiling except for individual modules
- Host: GitHub
- URL: https://github.com/olehdutchenko/babel-loader-exclude-node-modules-except
- Owner: OlehDutchenko
- License: mit
- Created: 2018-10-12T15:05:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-06-18T17:21:11.000Z (about 1 year ago)
- Last Synced: 2024-10-14T00:49:51.963Z (9 months ago)
- Topics: babel-loader, es6-modules, exclude, js-tiny-module, node-modules, webpack
- Language: JavaScript
- Size: 2.84 MB
- Stars: 19
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-loader-exclude-node-modules-except
[](https://github.com/WezomAgency/babel-loader-exclude-node-modules-except/blob/master/LICENSE)
[](https://github.com/topics/js-tiny-module)
[](https://www.npmjs.com/package/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
```js
// webpack.config.jsconst 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_
```js
// webpack.config.jsconst 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](https://github.com/AprilArcus)
- Thordur Thordarson [@earthslasthope](https://github.com/earthslasthope)---
#### License
[MIT License](https://github.com/WezomAgency/babel-loader-exclude-node-modules-except/blob/master/LICENSE)
---