core icon indicating copy to clipboard operation
core copied to clipboard

Support `browser` export condition out-of-the-box.

Open DarrenDanielDay opened this issue 2 years ago • 1 comments

What problem does this feature solve?

When using vue with a bundler such as esbuild, we need to manually configure an alias pointing from vue to vue/dist/vue.esm-bundler.js to get support for the runtime compiler. By adding a browser export condition, tool which supports conditional exports like esbuild can bundle vue with the correct mapping automatically.

What does the proposed API look like?

No new API will be added, but some additional metadata in vue/package.json:

{
  "exports": {
    ".": {
      "browser": {
        "import": "./dist/vue.esm-browser.js" // or "./dist/vue.esm-browser.prod.js", minified bundle by default
      },
      // ... other export conditions for "vue" entry
     }
  }
}

DarrenDanielDay avatar Nov 19 '22 13:11 DarrenDanielDay

https://github.com/vuejs/core/issues/7206 could follow the industry common,like vue 2 universal module definition

joebnb avatar Nov 29 '22 12:11 joebnb