Skip to content
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

Invalid WebSocket url in a Chrome extension context #2743

Closed
1 of 2 tasks
OriginalEXE opened this issue Sep 22, 2020 · 5 comments
Closed
1 of 2 tasks

Invalid WebSocket url in a Chrome extension context #2743

OriginalEXE opened this issue Sep 22, 2020 · 5 comments

Comments

@OriginalEXE
Copy link

  • Operating System: Windows 10
  • Node Version: 12.18.2
  • NPM Version: 6.14.5
  • webpack Version: 4.44.1
  • webpack-dev-server Version: 3.11.0
  • Browser: Chrome 85.0.4183.121
  • This is a bug
  • This is a modification request

Code

Expected Behavior

Webpack dev server transportMode: 'ws' should work as expected when loaded inside a context of a Chrome extension popup.

Actual Behavior

Webpack dev server transportMode: 'ws' throws an error that the url is not valid. The problem is with this line of code

_this.client = new WebSocket(url.replace(/^http/, 'ws'));

found in WebsocketClient.js

It assumes that the protocol will be one of http:/https:, but in chrome extension popup it's actually chrome-extension:

For Bugs; How can we reproduce the behavior?

Set the transportMode: 'ws' config to the dev server, and use it to serve a browser extension popup

@CPatchane
Copy link

Since in the v4, transportMode is now ws by default, we now get that error by default. At least, on my side, I am getting it in chrome.

@alexander-akait
Copy link
Member

@CPatchane Please create reproducible test repo

@CPatchane
Copy link

I got it in a big project, I'll try to reproduce it in a minimal repo 👍

@ylemkimon
Copy link
Contributor

Possibly fixed in master via #2954. Could you test it?

@alexander-akait
Copy link
Member

Yep, fixed, feel free to feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants