Parcel: Spread operator in node_module causes bundling failure

Created on 19 Feb 2018  路  7Comments  路  Source: parcel-bundler/parcel

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

Most helpful comment

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?

All 7 comments

I've tried that and stage-0 as well, which should include that if I'm not mistaken. Spread operators in my code seem to work fine (the files are listed as building earlier in the execution and throw no errors.) In this single node_module though they're not working.

Thanks very much for your quick reply though!

This is included in stage 3 and therefore also in stage 0.
(Not the first issue regarding stage-0: #824)

https://babeljs.io/docs/plugins/preset-stage-3/
https://babeljs.io/docs/plugins/preset-stage-0/

Okay I tried the --target=electron flag before without luck, but I've found after clearing my .cache folder it seems to build properly (with just stage-0)

Will reopen if I find this not to be the case.

I think this should be reopened. I am not able to make it work using babel-preset-stage-2 (using --no-cache all the time). I am trying to get rid of "Missing transform class propertie"s. We are hiding a bug by simply closing when somebody finds a workaround (like using the plugin or deleting cache). For the record I tried to go backwards in parcel-bundler version until 1.5.1 and it still didn't work.

UPDATE: This was closed by whom opened the issue I have created a new issue that links here (because seems related): https://github.com/parcel-bundler/parcel/issues/867

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?

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"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

donaldallen picture donaldallen  路  3Comments

Niggler picture Niggler  路  3Comments

davidnagli picture davidnagli  路  3Comments

urbanhop picture urbanhop  路  3Comments

466023746 picture 466023746  路  3Comments