-
-
Notifications
You must be signed in to change notification settings - Fork 476
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
build(openapi-fetch): bundle commonjs #1176
Conversation
|
I’m on board for this addition, so long as we have the CLI tests testing this CommonJS bundle as well. The major barrier for this existing in v6 wasn’t the actual bundling of it; it was maintenance, and getting bug reports for CommonJS that I don’t have time to support. Any way we can mitigate that by having the test suite ensure it works would help (FWIW, I don’t think the unit tests need to be duplicated; just the CLI tests expanded to test this bundle). |
What does the CLI test refer to here? It means to test if esbuild can bundle cjs properly?
We use cjs in our projects, and if we find a problem, we will try to fix it and submit a PR if possible. |
Oh the CLI test here: packages/openapi-typescript/test/cli.test.ts Should be as simple as duplicating those tests and setting
That would be enormously helpful, thank you 🙂 |
This PR is not about |
🤦 Ah I’m so sorry—I’m still getting used to these projects being merged together and I was hopping back-and-forth between package conversations today. This looks great! Sorry for my confusion. |
Co-authored-by: Drew Powers <1369770+drwpow@users.noreply.github.com>
@@ -9,6 +9,16 @@ | |||
"license": "MIT", | |||
"type": "module", | |||
"main": "./dist/index.js", | |||
"module": "./dist/index.js", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I’m fine with adding this, but this is more of an “invalid” / “legacy” property which was never officially standardized, which was why it was missing in the first place. It’s also not needed because it’s redundant with "main"
, but it’s also fine to include just in case it helps something.
Released in |
@drwpow How do I actually get the cjs output to be created? When I install the module using
Confirmed on the latest version. |
Ah sorry—this is a problem with the automated releases; not a problem with this PR at all. Will fix. |
Thanks for bearing with me on the automated releases. It’s a PITA to set up, and there are usually bugs like this for the first month or so. But long-term it’s much more sustainable. And improves the quality of the library because maintainers can release as well. |
@drwpow No worries at all - thank you for responding so quickly! Hugely appreciate it |
Changes
What does this PR change? Link to any related issue(s).
Also to fix #1102, but unlike #1103, this PR reuses
esbuild
instead of adding a new dependency.Just change the
--format
flag to bundle cjs.Ref https://esbuild.github.io/api/#format-commonjs
How to Review
How can a reviewer review your changes? What should be kept in mind for this review?
Is this type of bundling acceptable?
Checklist
N/A
Unit tests updatedREADME updatedexamples/
directory updated (only applicable for openapi-typescript)Other
If your project/package is being blocked by the lack of cjs distribution for openapi-fetch, you can temporarily try using
@kecrily/openapi-fetch
based on this PR before this PR is merged.