Module build failed: TypeError: this.setDynamic is not a function
See original GitHub issueI’m submitting a bug report
Webpack Version: 3.10.0
Babel Core Version: 7.0.0-beta.36
Babel Loader Version: 8.0.0-beta.0
Please tell us about your environment: Windows 10
{
{
"presets": ["@babel/preset-es2015",[
"@babel/preset-env", {
"target": {
"browsers": [
"last 2 versions",
"safari >= 7"
]
}
}
], "@babel/preset-react"],
"plugins": [
["transform-runtime", {
"polyfill": true,
"regenerator": true
}],
"transform-decorators-legacy",
"transform-class-properties",
"@babel/plugin-proposal-object-rest-spread",
["module-resolver", {
"root": ["./src"],
"alias": {
"styles": "./styles"
}
}]
],
"env": {
"test": {
"plugins": [
"transform-decorators-legacy",
"transform-class-properties"
]
}
}
}
}
Current behavior:
Module build failed: TypeError: this.setDynamic is not a function
at PluginPass.pre (C:\proj\src\login\node_modules\babel-plugin-transform-runtime\lib\index.js:31:12)
at transformFile (C:\proj\src\login\node_modules\@babel\core\lib\transformation\index.js:97:25)
at runSync (C:\proj\src\login\node_modules\@babel\core\lib\transformation\index.js:35:3)
at transformSync (C:\proj\src\login\node_modules\@babel\core\lib\transform-sync.js:15:38)
at Object.transform (C:\proj\src\login\node_modules\@babel\core\lib\transform.js:20:65)
at transpile (C:\proj\src\login\node_modules\babel-loader\lib\index.js:55:20)
at Object.module.exports (C:\proj\src\login\node_modules\babel-loader\lib\index.js:179:20)
Fix Removing this part of the .babelrc
"plugins": [
["transform-runtime", {
"polyfill": true,
"regenerator": true
}],
stops this error from happening but instead yields
Login.jsx?f401:32 Uncaught ReferenceError: regeneratorRuntime is not defined
in the browser
This is the babel-loader config
test: /\.jsx?$/,
exclude: /(node_modules|bower_components|public\/)/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-es2015','@babel/preset-env', "@babel/preset-react"]
}
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:35
- Comments:23 (5 by maintainers)
Top Results From Across the Web
Webpack babel-loader runtime: Module build failed: TypeError
After a struggle I've found the right way to do it. Tl;dr. If you install the new babel loader, you should load the...
Read more >TypeError: this.setDynamic is not a function - 潇湘羽西- 博客园
Module build failed (from ./node_modules/_babel-loader@8.0.6@babel-loader/lib/index.js): TypeError: this.setDynamic is not a function.
Read more >[Solved]-How to fix: this.setDynamic is not a function-babel.js
Module build failed (from ./node_modules/babel-loader/lib/index.js): · Gettting error ""Uncaught TypeError: Object.assign is not a function" in react app on ...
Read more >Module build failed: TypeError: this.setDynamic is not a function
Module build failed : TypeError: this.setDynamic is not a function ; I'm submitting a bug report ; Webpack Version: 3.10.0 ; Babel Core...
Read more >I still get an error after running the “npm install @babel/plugin ...
Here's the error I'm getting: in ./.nuxt/client.js. Module build failed: TypeError: this.setDynamic is not a function
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you’re using Babel 7’s Beta, you’ll need to install and use the Babel 7 version of the plugins too, e.g.
I had the same problem. Solved by uninstalling babel-plugin-transform-runtime, and installing @babel/plugin-transform-runtime instead.
I also needed to install @babel/runtime when using this plugin because of some error in helper libraries.
My .babelrc file now looks like this:
What really helped a lot was this resource: babel-plugin-transform-runtime
I hope this information helps you as much as it helped me.