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

Bundling: in micro frontends (mfe) as peer dependency #7322

Open
valeriiavask opened this issue Oct 9, 2024 · 0 comments
Open

Bundling: in micro frontends (mfe) as peer dependency #7322

valeriiavask opened this issue Oct 9, 2024 · 0 comments
Assignees
Labels
Status: Discussion Issue or pull request needs to be discussed by Core Team

Comments

@valeriiavask
Copy link

valeriiavask commented Oct 9, 2024

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

@valeriiavask valeriiavask added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 9, 2024
@melloware melloware added Status: Discussion Issue or pull request needs to be discussed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Discussion Issue or pull request needs to be discussed by Core Team
Projects
None yet
Development

No branches or pull requests

3 participants