I'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
```json {
test: /\.jsx?$/,
exclude: /(node_modules|bower_components|public\/)/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-es2015','@babel/preset-env', "@babel/preset-react"]
}
}
Why do you include @babel/preset-es2015?
I just remember that i needed it(alongside env) in another project to get it working. Removing it doesn't seem to fix this issue.
Im having a similar problem
Babel Version: 7.0.0-beta.36
babelrc
{
"presets": [
["env", {
"useBuiltIns": false,
}],
],
"plugins": [
"transform-runtime"
]
}
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.
{
"presets": [
["@babel/preset-env", {
"useBuiltIns": false,
}],
],
"plugins": [
"@babel/plugin-transform-runtime"
]
}
Ah, makes sense! Will update and check again
plugins: [
"transform-runtime"
]
still have the problem ....
@kousherAlam As mentioned above in https://github.com/babel/babel-loader/issues/560#issuecomment-362871436, if you're using Babel 7, then "@babel/plugin-transform-runtime" is the correct plugin to use.
with "@babel/plugin-transform-runtime" Still have the problem ...
i have
"@babel/runtime": "^7.0.0-beta.40",
"babel-plugin-transform-runtime": "^6.23.0",
package installed .
ERROR in ./src/js/start.js
Module build failed: Error: Cannot find module '@babel/plugin-transform-runtime' from 'E:\work\speeduptools\build_test'
at Function.module.exports [as sync] (E:\work\speeduptools\build_test\node_modules\resolve\lib\sync.js:40:15)
at resolveStandardizedName (E:\work\speeduptools\build_test\node_modules\@babel\core\lib\config\files\plugins.js:78:29)
at resolvePlugin (E:\work\speeduptools\build_test\node_modules\@babel\core\lib\config\files\plugins.js:27:10)
at loadPlugin (E:\work\speeduptools\build_test\node_modules\@babel\core\lib\config\files\plugins.js:35:18)
at createDescriptor (E:\work\speeduptools\build_test\node_modules\@babel\core\lib\config\config-descriptors.js:135:21)
at E:\work\speeduptools\build_test\node_modules\@babel\core\lib\config\config-descriptors.js:101:12
at Array.map (<anonymous>)
at createDescriptors (E:\work\speeduptools\build_test\node_modules\@babel\core\lib\config\config-descriptors.js:100:27)
at createPluginDescriptors (E:\work\speeduptools\build_test\node_modules\@babel\core\lib\config\config-descriptors.js:96:10)
at E:\work\speeduptools\build_test\node_modules\@babel\core\lib\config\config-descriptors.js:47:19
@ multi (webpack)-dev-server/client?http://0.0.0.0:8080 ./src/js/app.js ./src/js/start.js ./src/js/vendor.js
and the babel package is "@babel/core": "^7.0.0-beta.40",
"babel-plugin-transform-runtime": "^6.23.0"
That is the problem, as mentioned, it needs to be "babel/plugin-transform-runtime": "^7.0.0-beta.40"
{
// "plugins": ["transform-runtime","dynamic-import-node"],
"plugins": ["@babel/plugin-transform-runtime","dynamic-import-node"],
"presets": ["@babel/preset-env","@babel/preset-react"]
}
The comments is my fault config of .babelrc,you should upgrade "transform-runtime" to "@babel/plugin-transform-runtime"
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:
{
"presets":
[
[
"@babel/preset-env",
{
"targets": {
"browsers": ["last 2 versions"]
},
"debug": true
}
]
],
"plugins": ["@babel/transform-runtime"]
}
What really helped a lot was this resource:
babel-plugin-transform-runtime
I hope this information helps you as much as it helped me.
In a Nuxt project of mine hat worked for me — following this advice — was
npm install --save-dev @babel/plugin-transform-runtime
npm install --save @babel/runtime
followed by nuxt build and nuxt start — rather than npm run dev which is equivalent to nuxt.
Why this works I have no idea. This problem seems to crop up in projects generated with npx or yarn 芦create a Nuxt app禄 scaffolds.
@bretonio I also watched this error on nuxt.
The problem was that I used vue-app instead of @nuxtjs/babel-preset-app im my presets.
I have the same problem, followed a complete thread but couldn't able to fix it.
below is my babel.config.js code
module.exports = {
presets: [
['@vue/app', {
polyfills: [
'es6.promise', // already default included now
'es6.array.iterator', // already default included now
'es6.symbol',
'es6.object.assign'
]
}]
],
plugins: ['transform-vue-jsx', 'transform-runtime']
}
but it's giving me following error "TypeError: this.setDynamic is not a function"
below are my dependencies
"dependencies": {
"@babel/core": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"axios": "^0.18.0",
"babel-loader": "^8.0.4",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-2": "^6.24.1",
"babel-runtime": "^6.26.0",
"es6-promise": "^4.2.5",
"vue": "^2.5.17",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"webpack": "^4.27.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-service": "^3.0.1",
"@vue/eslint-config-standard": "^3.0.1",
"less": "^3.0.4",
"less-loader": "^4.1.0",
"vue-template-compiler": "^2.5.17"
}
can anybody help me out to fix it?
Without a stacktrace from the error, it is impossible to say.
For babel 7 yeah this
Seeing the same issue..
Stack trace:
ERROR in ./.nuxt/client.js friendly-errors 13:22:45
Module build failed (from ./node_modules/@nuxt/webpack/node_modules/babel-loader/lib/index.js): friendly-errors 13:22:45
TypeError: this.setDynamic is not a function
.babelrc
{
presets: [
[
"vue-app",
{
useBuiltIns: true
}
],
"flow"
],
plugins: ["transform-decorators-legacy", "transform-class-properties", "transform-runtime"],
env: {
test: {
plugins: ["babel-jest-assertions", "@babel/plugin-transform-runtime"]
}
}
}
I don't understand how both those solutions can work:
"plugins": ["@babel/transform-runtime"] in https://github.com/babel/babel-loader/issues/560#issuecomment-428544754
"plugins": ["@babel/plugin-transform-runtime"] in https://github.com/babel/babel-loader/issues/560#issuecomment-362871436
What's the right way? 馃槄
@Vadorequest apparently @babel/transform-runtime does not exit on npm.
Its new in Babel 7(.4) that you can shorten the names by plugins- and preset-. I think @babel/ ist now also unnecessary.
@babel/transform-runtime is the same as @babel/plugin-transform-runtime.
@maelyt Thanks for the input.
As if babel wasn't too confusing already... Now you also have to know there are aliases non-NPM-referenced that'll be used in open source projects and you're gonna have a hard time figuring out what those packages are.
I think @babel/ ist now also unnecessary.
As for @babel/ I'm not quite sure, I was under the impression that it the old packages weren't released under @babel/ namespace, but new ones are. And I doubt very much npm would resolve those, namespaces aren't optional. I would rather bet you're mistaken on this.
Working for vue cli + vuetify 3:
babel.config.js
module.exports = {
presets: [
'@vue/app'
]
}
vue.config.js
module.exports = {
runtimeCompiler: true,
"transpileDependencies": [
"vuetify"
]
}
Most helpful comment
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.