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

Error after upgrade to 3.3.0 - Uncaught SyntaxError: The URL '...' is invalid #1778

Closed
1 of 2 tasks
vitexikora opened this issue Apr 9, 2019 · 3 comments
Closed
1 of 2 tasks

Comments

@vitexikora
Copy link

vitexikora commented Apr 9, 2019

After running the project (start devServer via server.js - below) I always get this message, no matter the port and configuration setup:

Uncaught SyntaxError: The URL 'http:/[http//localhost:3000]' is invalid
    at new SockJS (webpack:///./node_modules/sockjs-client/dist/sockjs.js?:678)
    at initSocket (webpack:///(:3000/role/webpack)-dev-server/client/socket.js?:9:10)

You can see that the URL is kind of doubled.
After some headache, I localized this problem in webpack-dev-server v3.3.0.
While doing a routine deps upgrade, it got updated from 3.2.1 to 3.3.0 and that introduced this problem.

  • Operating System: Microsoft Windows [Version 10.0.17134.648]
  • Node Version: v10.13.0
  • NPM Version: 6.4.1
  • webpack Version: 4.29.6
  • webpack-dev-server Version: 3.3.0 (NOT in 3.2.1)
  • This is a bug
  • This is a modification request

Code

// webpack.config.js
{entry: [
    '@babel/polyfill',
    'webpack-dev-server/client?http://localhost:' + LISTEN_PORT + '/',
    'webpack/hot/dev-server',
    path.join(__dirname, 'src', 'index')
  ]}
// server.js
new webpackDevServer(webpack(config), {
  host: 'http://localhost:' + LISTEN_PORT,
  publicPath: config.output.publicPath,
  hot: true,
  inline: true,
  watchOptions: {
    aggregateTimeout: 300,
    ignored: /node_modules/
  },
  historyApiFallback: {
    index: 'index.html'
  },
  headers: {
    'Access-Control-Allow-Origin': '*'
  }
}).listen(LISTEN_PORT, 'localhost', someFunction)

Expected Behavior

No error

Actual Behavior

Error

For Bugs; How can we reproduce the behavior?

I do not have the time to prepare a minimum setup, I already lost plenty, but the server.js+webpack.config.js setup could be a good start.

For Features; What is the motivation and/or use-case for the feature?

@alexander-akait
Copy link
Member

I do not have the time to prepare a minimum setup, I already lost plenty, but the server.js+webpack.config.js setup could be a good start.

Sorry we can't fix something in anything

@alexander-akait
Copy link
Member

Also host should be without protocols

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

2 participants