question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spread operator in node_module causes bundling failure

See original GitHub issue

I’m using stage-0 and importing redux-throttle and getting an error that seems to be related to the spread operator.

C:\projects\myapp\node_modules\redux-throttle\src\index.js:52:17: Unexpected token (52:17)
[0]   50 |     } else if (typeof shouldThrottle === 'object') {
[0]   51 |       wait = shouldThrottle.wait || defaultWait
[0] > 52 |       options = {...defaultThrottleOption, ...shouldThrottle}
[0]      |                  ^
[0]   53 |     }
[0]   54 |
[0]   55 |     throttled[action.type] = throttle(next, wait, options)

This seems to be the same issue seen in https://github.com/parcel-bundler/parcel/issues/304, only I am already using stage-0 and have additionally tried the recommendations on that issue without luck.

🌍 Your Environment

Software Version(s)
Parcel 1.6.1
Node 8.9.1
npm/Yarn 1.3.2 (yarn)
Operating System Windows 7 x64

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
RoMaycommented, Jun 18, 2018

Have the same issue with spread operator in a node module:

$ ./node_modules/parcel-bundler/bin/cli.js ./index.html --no-cache
Server running at http://localhost:1234
parcel-test/node_modules/pwa-helpers/lazy-reducer-enhancer.js:37:8:
Unexpected token (37:8)
  35 |       const nextStore = nextCreator(origReducer, preloadedState);
  36 |       return {
> 37 |         ...nextStore,
     |         ^
  38 |         addReducers(newReducers) {
  39 |           this.replaceReducer(combineReducers(lazyReducers = {

Babel preset is installed and working fine with object spreading in the project code. Any suggestions here?

1reaction
Offirmocommented, Jul 18, 2018

Same problem. Cleaned my cache to no avail.

The node_module code is symlinked (monorepo) and exposed in package.json through both “source” and “jsnext:main”

Read more comments on GitHub >

github_iconTop Results From Across the Web

object spread operator detected as an error on webpack for ...
I'm trying to upgrade my application's node version from node6 to node8.6 which supports spread operator natively, all works fine until I ...
Read more >
Liferay 7 GA5 - NPM React Portlet Dependency Issue
I have used babel plugin: babel-plugin-transform-object-rest-spread into the ... gets successful but still getting an error while bundling redux@3.7.2.
Read more >
API - esbuild
If the entry names template had been just [name] instead, bundling would have failed because there would have been two output files with...
Read more >
Enable spread operator using babel/preset-env in node ...
React Native: How do you enable async functions? ... bundling failed: Error: Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `index.
Read more >
Node.js v19.3.0 Documentation
stackTraceLimit; error.cause; error.code; error.message; error.stack ... the error instance. operator <string> The operator property on the error instance.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found