Plugin-transform-runtime can't work without 'exclude: /node_modules/\/'
- Dominant language
- JavaScript
- Stars
- 4.8k
- Forks
- 456
- Avg merge
- 9h 19m
- Merged PRs (30d)
- 2
Description
**Webpack Version:**
4.25.1
**Babel Core Version**:
7.1.5
**Babel Loader Version**:
8.0.4
**Please tell us about your environment:**
OSX 10.x
**Current behavior:**
When I use **babel-loader** with **@babel/plugin-transform-runtime** in webpack. And I just forget to add _'exclude: /node_modules/\/'_ in my _webpack.config.js_, then my code has something wrong:

if I add _'exclude: /node_modules/\/'_ in webpack.config.js the problem will disappear.
I notice that :
> babel-loader is slow!
Make sure you are transforming as few files as possible. Because you are probably matching /\.m?js$/, you might be transforming the node_modules folder or other unwanted source.
I have searched everywhere, and I found this: https://stackoverflow.com/questions/43222249/webpack-2-3-3-typeerror-export-is-not-a-function
I think exclude the directory node_modules/ can speed up the babel-loader, but even if I include it, babel-loader and plugin-transform-runtime can still work properly.
**Expected/desired behavior:**
plugin-transform-runtime can work without 'exclude: /node_modules/\/'
**Here is my webpack.config.js:**
``` javascript
const path = require('path')
var webpack = require('webpack')
const processHandle = (percentage, message, ...args) => {
// console.log(percentage)
}
module.exports = {
entry: {
app: './src/index.js'
},
output: {
path: path.resolve(__dirname, 'build'),
filename: '[name].js'
},
devServer: {
port: 9000,
contentBase: path.join(__dirname, 'build')
},
mode: "development",
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env','@babel/preset-react'],
plugins: ['@babel/plugin-transform-runtime']
}
},
// exclude: /node_modules\//
},
{
test: /\.css$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
module: true
}
}
]
}
]
},
plugins: [
new webpack.ProgressPlugin(processHandle)
]
}
```
I am not sure that's a bug or there is something wrong with my code.
**Thanks for reading.**
Contributor guide
Assessment
This issue has not been assessed yet.