cpunion/react-actioncable-provider

You may need an appropriate loader to handle this file type.

ricvillagrana opened this issue ยท 12 comments

I am getting this error:

ERROR in ./node_modules/react-actioncable-provider/lib/index.js
Module parse failed: Unexpected token (147:12)
You may need an appropriate loader to handle this file type.
|           {
|             cable,
|             ...this.props,
|             ref: this.props.forwardedRef
|           },
 @ ./app/javascript/components/pages/Home/Home.js 11:0-61
 @ ./app/javascript/components ^\.\/.*$
 @ ./app/javascript/packs/application.js
 @ multi (webpack)-dev-server/client?http://localhost:3035 ./app/javascript/packs/application.js

I am as well. Here's my package.json in case seeing the version numbers is helpful?

  "name": "mirror",
  "private": true,
  "dependencies": {
    "@rails/webpacker": "3.5",
    "babel-preset-react": "^6.24.1",
    "prop-types": "^15.7.2",
    "react": "^16.8.3",
    "react-actioncable-provider": "^2.0.0",
    "react-dom": "^16.8.3"
  },
  "devDependencies": {
    "webpack-dev-server": "2.11.2"
  }
}```

Is this resolved? How can I help this?

Not solved yet, somehow the error is in the spread of this.props I don't know why.

@cpunion - Is there any update on this one? I'm getting this same issue when I use this package

@jaypandya73 no, but I'm using older version and it works fine. Namely "react-actioncable-provider": "1.0.3",

@dachinat - Okay thanks. giving it try now. and it's compatible with React 16.7 right?

Yes, I'm using "react": "^16.7.0", on that project.
Also, documentation for 1.0.3 is here https://github.com/cpunion/react-actioncable-provider/tree/1.0.3

Try not to use this.context there though (that's another way you can do things with that version). Otherwise it all works good.

pk1m commented

Same issue, I have "babel-plugin-transform-object-rest-spread", in my plugins but still get this issue.

I had a similar issue recently with my project (unrelated to this package). I'll see if I can't dig through my notes and figure something out when I'm at work tomorrow.

Any updates on this?

Any updates on this?

My notes didn't contain anything other than adding babel-plugin-transform-object-rest-spread to .babelrc fixed the issue.

We didn't upgrade React, but we did upgrade several other dependencies which led to the breakage.

In my case, I pulled lib/index.js directly into the project, as my Babel instance is not configured to transpile code in node_modules. Once done, the spread operator at (147:12) compiles, and I'm able to import the project.

Also, the 1.0.3 version, noted as working by @dachinat; should work as a node module, as the spread operator is not being used.

Hope this helps!