-
Notifications
You must be signed in to change notification settings - Fork 766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't import socket.io into Stencil app #495
Comments
Looks like this issue was reported with rollup here. rollup/rollup-plugin-commonjs#61 I tried the change outlined and it appears to work. |
@jthoms1 I tried the changes that were outlined and still get an error. Is there anything special you did to get it to work? I have tried:
When I build the app I get a bunch of warnings:
When I run the app, the app fails to load
|
Hi @cjorasch, I have it running for a couple of weeks with this code (Typescript): // Socket.IO client
import io from 'socket.io-client';
const ioFunc: any = (io as any).default ? (io as any).default : io;
const socket: any = ioFunc('http://localhost:3030', {
transports: ['websocket'],
forceNew: true
}); EDIT: I have added the module exclusively to my project as well (package.json): "dependencies": {
...
"bufferutil": "^3.0.3",
...
"utf-8-validate": "^4.0.0"
}, Anyway, it's a workaround. So rollup/Stencil don't seem to resolve this correctly.... |
Same. Workaround didn't work for me, getting error in the console:
|
Sadly it's blocking us to continue using Stencil for our projects... |
Check this issue. The fd erro relates to th ‚debug‘ module: #494 As a heavy workaround I habe exchanged all node.js files of each debug copy in node_modules with browser.js. Ugly I know. But my gut feeling and trust in Stencil is just too good ;-) |
I came up with a workaround to load Then it exposes Kind of defeats the purpose of stencil and bundling, but works for now. |
Could you elaborate on how you had success with dynamic loading of the library? |
Approach similar to this:
Loading from e.g unpkg.com |
I too am unable to get this working // package.json
"socket.io-client": "2.2.0" import io from 'socket.io-client'
Is this the Rollup config that is the issue? |
I'm also having the issue that I cannot get stenciljs to work with socket.io-client. Any more suggestions how to solve this elegantly? |
Hey guys, I think the secret is a Stencil config like this:
Note the |
The Stencil config fixed it for me... Thank you |
@bitflower |
The fix from @bitflower doesn't work in Stencil One (1.0.0-beta.2). Using:
And the config from bitflower's post above, I get this error on
Any thoughts? |
Hey, Stencil 1.0.0 still seems to have this issue (it works in 0.18.1-0). Any possible work arounds y'all can think of? I would love to upgrade to 1.0.0 but this is blocking me. I can throw together a repo with just this problem if that helps. |
I created a project recreating the specific problem, posting here so things don't get lost: |
This issue is resolved in stencil v1.0.1! Thanks @manucorporat |
Repo with the problem outlined:
https://github.com/bitflower/stencil-socketio-problem
Current behavior:
Neither socket.io nor socket.io-client can be imported into Stencil.
Steps to reproduce:
See repo
... and then
npm run dev
Hope you have a minute to check this out as I'm far from being an expert in rollup! :-)
The text was updated successfully, but these errors were encountered: