Subscribe on changes!

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

avatar
Nov 19th 2022

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
     }
  }
}
avatar
Nov 29th 2022

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