Add production build for esm-browser
Change the rollup config to also build pinia for esm browsers prod It will remove devtools and minify the code
Closes #2205
Summary by CodeRabbit
-
New Features
- Introduced a minified production browser bundle for faster load times.
- Added a distinct ESM browser output filename (esm-browser.prod) for easier identification and CDN consumption.
-
Chores
- Improved classification of browser builds as raw ESM to enhance compatibility with modern tooling.
- Adjusted dependency handling for the browser production build to simplify integration.
- No changes to public APIs.
Deploy Preview for pinia-official ready!
| Name | Link |
|---|---|
| Latest commit | e9c3532b3e1123470b97bc38b2e1c634e95020d0 |
| Latest deploy log | https://app.netlify.com/projects/pinia-official/deploys/68a09ea0c8f35a0008f1b794 |
| Deploy Preview | https://deploy-preview-2939--pinia-official.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
I would appreciate it if you could take a look at this PR, @posva.
Will be really helpful to be able to use Pinia with Micro-Frontends using importmaps.
Hey @porfirioribeiro! Thanks for the PR, I still haven't got the time to take a look but I wanted to tell you that if you rebase from (or merge) v3, it should activate automatic releases so it can be used temporarily like these: https://github.com/vuejs/pinia/runs/47624782567
Walkthrough
Updates rollup.config.mjs to add a minified browser production build (“browser-prod”), adjust raw ESM detection to include all browser variants, set external dependencies to only 'vue' for browser-prod, and alter output naming to esm-browser.prod.js for the browser format.
Changes
| Cohort / File(s) | Summary |
|---|---|
Build configurationrollup.config.mjs |
Adds 'browser-prod' minified build; treats any 'browser' build as raw ESM; sets externals to ['vue'] for browser-prod while keeping '@vue/devtools-api' external elsewhere; updates output naming to dist/name.esm-browser.prod.js for browser-prod; routes minified browser build via 'browser-prod'. |
Sequence Diagram(s)
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Assessment against linked issues
| Objective | Addressed | Explanation |
|---|---|---|
| Vue 3 ESM prod bundle depending only on vue (no vue-demi) [#2205] | ✅ | |
| Exclude @vue/devtools-api in prod bundle [#2205] | ❓ | External list change alone may not exclude code; depends on compile-time gating/tree-shaking not shown. |
| Provide separate prod and dev browser bundles [#2205] | ❓ | 'browser-prod' added; presence/configuration of a distinct dev counterpart in this diff is not shown. |
Assessment against linked issues: Out-of-scope changes
Poem
I nibbled the build, made a prod-flavored treat,
With ESM crunchy and Vue-only sweet.
I trimmed the leaves of demi and tools,
Named it just so, per bundling rules.
Now to the meadow—ship it fleet! 🐇✨
[!TIP]
🔌 Remote MCP (Model Context Protocol) integration is now available!
Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
🧪 Generate unit tests
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. - PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
-
Support
Need help? Create a ticket on our support page for assistance with any issues or questions.
CodeRabbit Commands (Invoked using PR/Issue comments)
Type @coderabbitai help to get the list of available commands.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Status, Documentation and Community
- Visit our Status Page to check the current availability of CodeRabbit.
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Hey @porfirioribeiro! Thanks for the PR, I still haven't got the time to take a look but I wanted to tell you that if you rebase from (or merge)
v3, it should activate automatic releases so it can be used temporarily like these: https://github.com/vuejs/pinia/runs/47624782567
Thanks @posva, whenever you have time take a look at this.
The temporarily deployed URLs will be helpful for testing. But would be nice to have this official so it could be part of the other npm CDNs
Thank you
npm i https://pkg.pr.new/@pinia/nuxt@2939
npm i https://pkg.pr.new/pinia@2939
npm i https://pkg.pr.new/@pinia/testing@2939
commit: e9c3532