primefaces / primefaces/primereact

Bundling: in micro frontends (mfe) as peer dependency

Open
#7,322 0 comments 0 reactions 1 assignee View on GitHub

@mertsincan is already working on this.

Since Oct 9, 2024.

Status: Discussion
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

adding primereact to peerDependencies is not excluding it from the bundle using vite rollupOptions.external

this is important use case when there are multiple projects like in a mfe ecosystem, where we want in the final app to include and load shared libraries only once

i was able to reduce bundle size by excluding all submodules
image

but this makes it impossible to resolve given submodules in the main app, because we are trying to get it to resolve using esm shared import:
https://cdn.jsdelivr.net/npm/primereact@10.8.2/+esm
of course it fails:
image
because there's no such module in package, and the esm module primereact@10.8.2 is not resolving it either

for example we can mark react as an external dependency in vite, peerDependency in package.json, and include it only once using a similar link:
"react": "https://cdn.jsdelivr.net/npm/react@18.2.0/+esm",
"react-dom": "https://cdn.jsdelivr.net/npm/react-dom@18.2.0/+esm",

we would like to achieve something similar using primereact

any tips would be greatly appreciated

Reproducer

No response

System Information
"primereact": "^10.8.2",
    "react": "^18.2.0",
    "vite": "^5.4.8",
Steps to reproduce the behavior

No response

Expected behavior

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.