Skip to content

Bundle ESM for Vue 3 prod #2205

@porfirioribeiro

Description

@porfirioribeiro

What problem is this solving

I'm trying to use pinia in a microfrontends architecture, and we are planing to use importmaps to solve duplication of bundling dependencies.
So we're mapping pinia to https://cdn.jsdelivr.net/npm/pinia/dist/pinia.esm-browser.js

But it comes with some issues.

  • Pinia imports vue-demi, i think it's great that pinia support both Vue 2 and 3, but this hurts the esm imports as i will need to add an import map for vue-demi also
  • It also imports @vue/devtools-api, which is great in development, but could probably be avoided in prod

I have a working example https://jsfiddle.net/porfirio/qh8pf5xb/22/

Proposed solution

Have a new bundle without vue-demi and pointing directly for vue (3)
Probably create 2 bundles, one for prod without devtools, other for dev.

The pinia-esm-vue3 bundle, should only have the dependency on vue

Describe alternatives you've considered

It is possible to make it work, as-is, but it brings a lot of configuration that needs to be added

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions