Closed veltman closed 5 years ago
I've encountered the same issue, and confirm that wrapping in another spread works around the issue.
I'm also getting some spread errors using the rollup plugin.
@danielnaab @maranomynet Can you reproduce your problems when using bublé directly?
@adrianheine yes - this is a Bublé bug, not rollup-plugin-buble
.
I've opened Rich-Harris/buble#163.
@adrianheine Sorry, I jumped the gun on my response. I ran @veltman's code incorrectly via the command line - I failed to provide the --objectAssign
parameter. I am able to compile it, but can't speak to its correctness.
I checked its correctness and it's not correct :)
@adrianheine This happens with bublé directly.
The following code results in an error:
// spreadtest.js
const foo = { ...bar };
... but if I run buble ./spreadtest.js -- objectAssign Object.assign
then it works correctly.
I only assumed it was problem with the plugin since the bublé REPL doesn't give this error.
I'll file a separate issue against the Bublé project.
Oh, found an existing issue: Rich-Harris/buble#135
Oh, that's a documentation issue in this module. You can just pass objectAssign
as options property:
import { rollup } from 'rollup';
import buble from 'rollup-plugin-buble';
rollup({
entry: 'main.js',
plugins: [ buble({objectAssign: true}) ]
}).then(...)
actually, objectAssign: true
doesn't work, you have to pass the string Object.assign
Whereas on the command-line you can pass a bare --objectAssign
flag.
The documentation could be a lot clearer regarding this whole mess.
You're right, I just fixed that in Rich-Harris/buble@7fd340698fd27a201cc12e2d23a856e5e5e00882.
The Rollup team is attempting to clean up the Issues backlog in the hopes that the active and still-needed, still-relevant issues bubble up to the surface. With that, we're closing issues that have been open for an eon or two, and have gone stale like pirate hard-tack without activity.
We really appreciate the folks have taken the time to open and comment on this issue. Please don't confuse this closure with us not caring or dismissing your issue, feature request, discussion, or report. The issue will still be here, just in a closed state. If the issue pertains to a bug, please re-test for the bug on the latest version of Rollup and if present, please tag @wesleygrimes and request a re-open, and we'll be happy to oblige.
I'm getting a strange
Unexpected token
error withrollup-plugin-buble@0.19.2
androllup@0.53.4
when using a nested spread operator followed by a computed property name:consider the following sample file:
and the following bundle script:
This works. But if I flip the order of lines 5 & 6, so the spread comes first:
I'll get an unexpected token error.
I can avoid the error by wrapping the last line in another spread:
The strange thing is, this only happens with the plugin. If I transpile directly:
I don't get an error. Any ideas? Am I doing something dumb and not seeing it?