ES bundle uses CommonJS-style exports.
See original GitHub issueQ&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…
- 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:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
@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.