"babel-plugin-transform-object-rest-spread": "~6.20.2"Hi,
I saw you just released babel-plugin-transform-object-rest-spread package version 6.20.0, and I've been getting Maximum call stack size exceeded from all my projects.
Stack trace:
RangeError: /Users/trilok/work/restaurants-redux/src/reducers/I18nReducer.js: Maximum call stack size exceeded
at Function.get (/Users/trilok/work/restaurants-redux/node_modules/babel-traverse/lib/path/index.js:76:30)
at TraversalContext.create (/Users/trilok/work/restaurants-redux/node_modules/babel-traverse/lib/context.js:68:27)
at TraversalContext.visitMultiple (/Users/trilok/work/restaurants-redux/node_modules/babel-traverse/lib/context.js:99:25)
at TraversalContext.visit (/Users/trilok/work/restaurants-redux/node_modules/babel-traverse/lib/context.js:190:19)
at Function.traverse.node (/Users/trilok/work/restaurants-redux/node_modules/babel-traverse/lib/index.js:114:17)
at NodePath.visit (/Users/trilok/work/restaurants-redux/node_modules/babel-traverse/lib/path/context.js:115:19)
at TraversalContext.visitQueue (/Users/trilok/work/restaurants-redux/node_modules/babel-traverse/lib/context.js:150:16)
at TraversalContext.visitSingle (/Users/trilok/work/restaurants-redux/node_modules/babel-traverse/lib/context.js:108:19)
Thanks! can you post a minimal code snippet? I see that it's erroring there but would need more info to debug.
I'll try to create a minimal one. While I try, here's an example of a line of code that created the problem:
fixture.reservations = {...fixture.reservations, availability};
I thought it might be connected to using the same variable, but now I get it on a different code which doesn't have that.
I'll try to create something minimal.
Ok I figured out one - just a nested spread.
let newState = {
...state,
a: {
...action.newProps
}
};
Ok figured it out, will fix
Thanks!!!
issues is from via https://github.com/babel/babel/pull/4883 cc @christophehurpeau
https://github.com/babel/babel/pull/4974 - the issue is that the sub-traversal was doing an infinite loop and we just need to stop it after getting the true
Publishing now!
Published - please verify! https://unpkg.com/[email protected]/
getting this error now
You may need an appropriate loader to handle this file type.
| const config = {
| series,
| ...options
| };
not exactly sure yet if it's babel's fault, but I get this for code that worked earlier on:
/Users/trilok/work/restaurants-redux/src/reducers/I18nReducer.js:53
return { ...state, secondarySwitched, uxMode, uxLanguage };
^^^
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:511:25)
at loader (/Users/trilok/work/restaurants-redux/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/trilok/work/restaurants-redux/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/trilok/work/restaurants-redux/spec/reducers/I18nReducer.spec.js:2:1)
at Module._compile (module.js:541:32)
at loader (/Users/trilok/work/restaurants-redux/node_modules/babel-register/lib/node.js:144:5)
We are getting the exact error
herit', env: { ...getDeployEnv(process.env.ENV), WORKERNAME: workerName } })));
^^^
SyntaxError: Unexpected token ...
Hmm that seems really weird.. will look into it
Can you make sure you make cleared cache for npm/ rm -rf node_modules?
I just did
var a = { ...state, secondarySwitched, uxMode, uxLanguage };
on a new repo with
"babel": {
"plugins": [
"transform-object-rest-spread"
]
}
and it works?
Yes, I cleaned and npm installed from scratch when it happened.
Didn't clean cache. Will try.
We now get:
/Users/adam/code/some/repo/lib/file.js:807
value: async function updateAccount(id, data) {
^^^^^^^^
SyntaxError: Unexpected token function
Same issue after clean installing with both yarn and npm. Also node_modules/babel-plugin-transform-object-rest-spread/package.json confirms that the version is 6.20.1
Not quite sure what the right fix should be, but I _think_ that https://github.com/babel/babel/pull/4974/files#diff-7eea231ceccdb3e5ebbe71c90fd9de0fR7 bails out too early and stops traversing the AST?
ERROR in ./src/components/Sidebar.js
Module parse failed: /home/ubuntu/product-store/node_modules/babel-loader/lib/index.js?cacheDirectory=tmp/babel-cache!/home/ubuntu/product-store/src/components/Sidebar.js Unexpected token (40:8)
You may need an appropriate loader to handle this file type.
| style: {
| transform: `translateX(${ transform }px)`,
| ...styles.content
| }
| }), void 0, children);
@ ./src/routes/Remove/Remove.js 8:0-47
@ ./src/routes.js
@ ./src/app.js
@ ./src/index.js
@ multi main
For those who need an immediate resolution, setting
"babel-plugin-transform-object-rest-spread": "~6.19.0"
in your package.json, rimraf node_modules, and reinstalling should get you back up and running.
@irvinebroque not sure why it's failing in that case because for 1 the "unexpected token error" comes from the parser which should be happening before any of the transforms.
And 2 I have a test in the PR that covers nested and non-rested?
Still happens to me - trying to create a minimal code snippet. Just a basic one works - working on it.
@hasSean still have the same issue after installing "babel-plugin-transform-object-rest-spread": "~6.19.0"
You may need an appropriate loader to handle this file type.
| const config = {
| series,
| ...options
| };
|
If you are using babel-loader you will probably need to clear that cache too - can you delete ./node_modules/.cache/ if it's there?
(Still looking into this)
@hzoo Any idea on https://github.com/babel/babel/issues/4972#issuecomment-265900542 ? It seems there's a bunch of other stuff broken now. Perhaps it would be better to temporarily unpublish the new version?
@DanialK seems like that error is bubbling out of webpack https://github.com/webpack/webpack/blob/54aa3cd0d6167943713491fd5e1110b777336be6/lib/ModuleParseError.js#L10
What does your project's webpack configuration look like for loaders? Mine is
resolveLoader: {
fallback: path.join(__dirname, 'node_modules')
},
I have babel-loader at 6.2.9 for what it's worth
ok, I found a lead. Doesn't happen to me when I just 'babel' a directory
Happens to me when I use mocha and babel-register.
@3LOK we're also seeing it on babel-node
If it's helpful, react native (v0.37) hits this with the latest publish:
```
.../node_modules/react-native/local-cli/util/Config.js:43
cwd: string,
^
SyntaxError: Unexpected token :
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:404:25)
at loader (.../node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (.../node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.
at Module._compile (module.js:425:26)
Here's my example:
.babelrc file
{
"presets":["es2015", "stage-2"],
"plugins":["transform-runtime"]
}
package.json
{
"dependencies": {
"babel-cli": "*",
"babel-plugin-transform-runtime": "*",
"babel-preset-es2015": "*",
"babel-preset-stage-2": "*",
"mocha": "^3.2.0"
}
}
src/a.js
export default {
foo(a) {
const b = {foo:'bar'}
a = {...a, 'hello':'world', b};
return a;
}
}
test/a.test.js
import a from '../src/a.js'
describe('Dummy', () => {
it('dummy', () => {
});
});
Command that fails:
node_modules/mocha/bin/_mocha --compilers js:babel-register -- "test/**/*.test.js"
This command works:
./node_modules/babel-cli/bin/babel.js -d dist src
I still see some untransformed ... spreading sign after babel command.
@3LOK There's a "register" cache too - can you delete username/.babel.json?
Actually, @picodoth's comment is correct - the cli doesn't transform the '...'
no, cleaning the cache didn't help :(
Ok just going to revert that part.
Looks like removing .babel.json and reverting to object spread 6.19.0 fixed the immediate problem
Sorry about this all
reverting to the last working version should always work :)
@hzoo "sorry"?! for managing one of the most useful and popular tools out there? :) Thanks for all your effort!
lol wow I really need someone to review these PRs.. got a fix.
https://github.com/babel/babel/pull/4976 wow (didn't look at the output clearly enough obviously)
Will merge/publish after i get a thumb
no pressure. it's just 3:15am here :)
alright 2nd time! super hope [email protected] works
Ok it seems to pass in my local now - verify? 馃槃
Yup! Works! Thanks for all the effort!
Phew, time to stop. Thanks everyone the reports and help! 馃槾
Thank you for all the hard work @hzoo!
Thanks for the quick fix. When will 6.20.2 be the "latest" release?
Ah that's just the release "changelog" - too tired to do so but it's out and will update later. The actual pkg was released.
馃啋 Thanks, have a nice 馃槾
Most helpful comment
Phew, time to stop. Thanks everyone the reports and help! 馃槾