Reputation: 2159
I have this error when I try to compile my app. The error comes from babel-plugin-proposal-object-rest-spread
here https://github.com/babel/babel/blob/6e551ae8827d064680c1344074db9fb3093967e9/packages/babel-plugin-proposal-object-rest-spread/src/index.js#L22 :
Trace: error TypeError: api.targets is not a function | at /home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/preset-env/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js:38:25 | at /home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/preset-env/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12 | at /home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/core/lib/config/full.js:166:14 | at cachedFunction (/home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/core/lib/config/caching.js:32:19) | at loadPluginDescriptor (/home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/core/lib/config/full.js:201:28) | at /home/username/Documents/front-newlook/node_modules/next/node_modules/@babel/core/lib/config/full.js:71:20
My babel.config.json
is like this:
{
"plugins": [
"emotion",
"macros",
"@babel/plugin-proposal-class-properties"
],
"presets": ["next/babel"],
"env": {
"test": {
"plugins": ["require-context-hook"]
}
}
}
Does anyone has an idea? Thank you
Upvotes: 3
Views: 3791
Reputation: 2159
The problem was solved when I removed the node_modules
folder and then ran yarn install
Upvotes: 9