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

Throw Uncaught Error: Mismatched anonymous define() module when using esm/standalone.mjs with RequireJS #12560

Closed
zjffun opened this issue Mar 30, 2022 · 1 comment · Fixed by #13536

Comments

@zjffun
Copy link

zjffun commented Mar 30, 2022

Environments:

  • Prettier Version: 2.6.1
  • Running Prettier via: Browser API
  • Runtime: Chrome
  • Operating System: macOS
  • Prettier plugins (if any): parser-html

Steps to reproduce:

  1. Add requirejs;
  2. Import prettier esm/standalone.mjs;
  3. Use prettier.

Expected behavior:

Don't throw error.

Actual behavior:

Throw Uncaught Error: Mismatched anonymous define() module.


Reproduction: prettier-with-requirejs

I make a simple fix: fix-prettier-with-requirejs

This fix adds ESModule exports of parse-srcset zjffun/parse-srcset@a5e0f86. Because prettier using require to load modules, so I also changed the require of parse-srcset in prettier zjffun@944b686.

This fix only provides an idea and can't be used as a final solution, because there may be problems in the node environment.

@thorn0 thorn0 linked a pull request Sep 26, 2022 that will close this issue
4 tasks
@fisker
Copy link
Member

fisker commented Sep 27, 2022

Fixed by #13536

@fisker fisker closed this as completed Sep 27, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants