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: Unexpected usage at e.loadForeignModule #5

Closed
xavArtley opened this issue Mar 3, 2020 · 2 comments
Closed

Error: Unexpected usage at e.loadForeignModule #5

xavArtley opened this issue Mar 3, 2020 · 2 comments

Comments

@xavArtley
Copy link

xavArtley commented Mar 3, 2020

Hello I was just trying the demo on https://vanillawc.github.io/wc-monaco-editor/demo/index.html
And looking at the jsconsole I get this error:

Error: Unexpected usage
    at e.loadForeignModule (index.min.js:1)
    at index.min.js:1

each time I enter a new character

@evanplaice
Copy link
Member

evanplaice commented Mar 25, 2020

Thanks for reporting this

The error occurs because Monaco fails to side-load the service worker modules. Looks like the error occurs when the web component is loaded from another domain.

I have updated the demo to load the source relative to the web component (ie the same domain), fixing the issue and reflecting actual usage.

In a prod environment where the web component and all of it's assets are located on the same server, this error should not be present.

If the only choice is to load the web component from another domain, the editor should still work despite the errors. It will do all the language-server-protocol (ie syntax analysis, etc) on the main thread instead of offloading the work to a service worker.

@evanplaice
Copy link
Member

Fixed in v1.4.5

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