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: Can only have one anonymous define call per script file #2283

Closed
stagefright5 opened this issue Dec 23, 2020 · 1 comment
Closed

Error: Can only have one anonymous define call per script file #2283

stagefright5 opened this issue Dec 23, 2020 · 1 comment
Labels
info-needed Issue requires more information from poster

Comments

@stagefright5
Copy link

stagefright5 commented Dec 23, 2020

Dynamically requiring the strong-soap module causes this error. [Please read on].

This happens when I try to dynamically import strong-soap module and the monaco-editor is included.
If any other module is dynamically required or if the monaco-editor component is not included.

The steps to reproduce is mention in this repo's README.md file
I have raised the issue in strong-soap repo too (here). Any help is appreciated.

monaco-editor version: 0.20.0
Browser: Electron v9
OS: Any
Playground code that reproduces the issue: https://github.com/stagefright5/strong-soap-dynamic-module-load-issue#strong-soap-dynamic-module-load-issue
Related issue: loopbackio/strong-soap#304

error

@alexdima
Copy link
Member

alexdima commented Dec 29, 2020

This usually indicates that a script which was not loaded via the AMD loader invokes define. If the script you are trying to load is authored with UMD or AMD support (probes for existance of define and then invokes it), you can do the following:

  • ensure that the script is loaded before loader.js
  • (or) undefine global.define before loading the script and redefine it after the script has finished loading
  • (or) load the script through the AMD loader e.g. (require(['my/script/module/id'], () => { }, (err) => { }))
  • (or) give up on using AMD and use the ESM variant of the monaco editor

@alexdima alexdima added the info-needed Issue requires more information from poster label Dec 29, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants