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(build): provide esm package #994

Merged
merged 1 commit into from
Apr 26, 2023
Merged

fix(build): provide esm package #994

merged 1 commit into from
Apr 26, 2023

Conversation

ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Apr 25, 2023

It seems, this library conflicts with the current @nextcloud/webpack-vue-config v5.5.0.

It provides only cjs module that consider Vue package to be cjs as well.
But apps (at least Talk) mostly uses esm by default.

  • It wasn't a problem in v0.10.0 before migrating to Vite, because previously it was built to esm.
  • It wasn't a problem with @nextcloud/webpack-vue-config v5.4.0. An old config just built an app with both esm and cjs vue copies in the bundle. But in v5.5.0 there was added resolve alias for vue. It results with using only one Vue package in the built and helps to get rid of multiple Vue on the page. At the same time, it broke building an app with this library, providing wrong Vue module type.

This PR:

  1. Adds esm to build targets
  2. Adds exports field to package.json providing proper entrypoint to each module type
  3. Adds module field to package.json as a fallback for all tools not supporting exports
  4. Removed library field from package.json (I have found no mentions about this field. Neither in npm docs, nor in nodejs or webpack/vite docs...
  5. Removed global settings from rollup config. It is not required if we don't built iife / umd with global Vue.
  6. Moved vue from dependencies to peerDependencies as it is a peer by design.
  7. Removed @nextcloud/vue duplication from peerDependencies.

Related: nextcloud/spreed#9236

@ShGKme ShGKme added the bug Something isn't working label Apr 25, 2023
@ShGKme ShGKme self-assigned this Apr 25, 2023
@ShGKme ShGKme changed the title feat(build): provide esm package fix(build): provide esm package Apr 26, 2023
Signed-off-by: Grigorii Shartsev <grigorii.shartsev@nextcloud.com>
@ShGKme
Copy link
Contributor Author

ShGKme commented Apr 26, 2023

Also checked, that there is no problems on server build (on master).

@ShGKme ShGKme merged commit 2dd4a7c into master Apr 26, 2023
4 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix/esm-package branch April 26, 2023 12:55
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.

None yet

2 participants