question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ES bundle uses CommonJS-style exports.

See original GitHub issue

Q&A (please complete the following information)

  • Swagger-UI version: 3.37.2
  • Swagger/OpenAPI version: N/A

Content & configuration

Apologies if this isn’t considered a bug, but I couldn’t find anything clearly explaining this. The ES bundle artefacts still use CommonJ-style exports. I expected that they would be utilising ES6/ES2015-style exports, for use in frameworks like Angular and others that prefer the ES format over CommonJS, for tree-shaking purposes.

swagger-ui-es-bundle.js: module.exports=function(e){var t={};function...

Should be something like: export default function(e){var t={};function...

Example Swagger/OpenAPI definition: N/A

Swagger-UI configuration options: N/A

Describe the bug you’re encountering

To reproduce…

  1. Have a look at swagger-ui-es-bundle.js

Expected behavior

ES module should use ES-style exports.

Screenshots

N/A

Additional context or thoughts

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andy-hancommented, Jun 16, 2022

Hello, is there any update to this? My organization has pretty strict compliance with our angular app, and this issue is preventing us from using this package.

0reactions
TimUnderhaycommented, Feb 19, 2021

@linelson as a temporary workaround, I’ve published a version with a corrected ES bundle. I intend to unpublish as soon as this is issue has been fixed, but should you wish to use it, it’s @kensingtontech/swagger-ui. I see that there is a PR in progress @ https://github.com/swagger-api/swagger-ui/pull/6720 so hopefully it won’t be too much longer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CommonJS vs. ES modules in Node.js - LogRocket Blog
In the browser JavaScript ecosystem, the use of JavaScript modules depends on the import and export statements; these statements load and export ...
Read more >
How CommonJS is making your bundles larger - web.dev
In this post, we'll look into what CommonJS is and why it's making your JavaScript bundles larger than necessary.
Read more >
The JavaScript Modules Handbook – Complete Guide to ES ...
A JavaScript module is a file that allows you to export its code. This allows other JavaScript files to import and use the...
Read more >
Node Modules at War: Why CommonJS and ES ... - Code Red
... are old-style CommonJS (CJS) scripts and new-style ESM scripts (aka MJS). CJS scripts use require() and module.exports; ESM scripts use ...
Read more >
ECMAScript modules | Node.js v19.3.0 Documentation
The following example of an ES module exports a function: ... Outside of those cases, Node.js will use the CommonJS module loader.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found