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: es interop with @nextcloud/axios #10

Merged
merged 2 commits into from
May 22, 2024

Conversation

ShGKme
Copy link
Contributor

@ShGKme ShGKme commented May 21, 2024

Fixes 2 issues:

  • import {post} from '@nextcloud/axios' is not a valid ES import. There is no post exported from @nextcloud/axios. It luckily worked when the module was only used in CJS with pure CJS because it is valid for require. But it is not valid for import.
  • Library builds as CJS but uses other libraries. It's good to support importing modules with _esModule so "ESM-based" CJS libraries works fine. Enabled via esModuleInterop: true

Alternative solution could also be using any bundler like Rollup or Vite and build an ESM version as well. In most cases an ESM version is used in our infra.

@ShGKme ShGKme requested review from icewind1991 and susnux May 21, 2024 16:49
@ShGKme ShGKme self-assigned this May 21, 2024
@ShGKme ShGKme added the bug Something isn't working label May 21, 2024
Copy link
Contributor

@mejo- mejo- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well with Collectives.

@mejo- mejo- force-pushed the fix/es-interop-with-axios branch from a1a99c0 to 8528ad3 Compare May 22, 2024 08:52
@mejo- mejo- merged commit 2650b3c into nextcloud-libraries:main May 22, 2024
5 checks passed
@ShGKme ShGKme mentioned this pull request May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants