Skip to content

Uncaught SyntaxError: The URL '/sockjs-node' is invalid #2

@vedam

Description

@vedam

Hey Jason,
first of all thx for this.
I'm experimenting with animateplus.js wich relies on async/await.
That's another thing ;-)

I tried to install the plugin in a new folder
preact create simple

went through including installing deps

I added the plugin as described:
npm i -D preact-cli-plugin-async

package.json

"devDependencies": {
  ...,
  "preact-cli-plugin-async": "^1.0.0"
},

I created and edited a 'preact.config.js' as described:

import asyncPlugin from 'preact-cli-plugin-async'

export default config => {
  asyncPlugin(config)
}

starting in dev-mode:
npm run dev

everything seems fine first:

Compiled successfully!
...

But opening http://localhost:8080 in browser[chrome]
logs:

sockjs.js?83d2:678 Uncaught SyntaxError: The URL '/sockjs-node' is invalid

...
  // Step 1 of WS spec - parse and validate the url. Issue #8
  var parsedUrl = new URL(url);
  if (!parsedUrl.host || !parsedUrl.protocol) {
    throw new SyntaxError("The URL '" + url + "' is invalid");    <-------- this throws X
  } else if (parsedUrl.hash) {
    throw new SyntaxError('The URL must not contain a fragment');
...

running without preact.config.js works
Unfortunately I have no idea what to do to fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions