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

fix: allow importing SwaggerUI in Node.js #9137

Merged
merged 2 commits into from
Aug 17, 2023
Merged

fix: allow importing SwaggerUI in Node.js #9137

merged 2 commits into from
Aug 17, 2023

Conversation

char0n
Copy link
Member

@char0n char0n commented Aug 17, 2023

This includes:

  • ESM
  • CommonJs

Refs #8311

This includes:

- ESM
- CommonJs

Refs #8311
@char0n char0n merged commit 78f6ffb into master Aug 17, 2023
6 checks passed
@char0n char0n deleted the char0n/8311 branch August 17, 2023 13:08
@rcollette
Copy link

I still get a lot of warnings when building an Angular application, like:

Warning: /client/node_modules/swagger-ui/dist/swagger-ui-es-bundle-core.js depends on 'zenscroll'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Are the swagger dependencies being brought in using ESM?

@char0n
Copy link
Member Author

char0n commented Aug 19, 2023

Hi @rcollette,

Are the swagger dependencies being brought in using ESM?

Yes they are. zenscroll is one of the deps used by SwaggerUI. This dep is defined as UMD. So whey you're seeing the above mentioned warning, you're blunder is telling you that its pulling in the UMD instead of ESM even though it has been imported using import statement. Unfortunately there no much that can be done, except replacing the library with another pure ESM one. You can safely ignore the warning as it's just telling you that the bundler will not apply any optimizations like tree-shaking. Given that the zenscroll library is only 300 SLOC long, I wouldn't worry about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants