core icon indicating copy to clipboard operation
core copied to clipboard

build: use cjs/mjs extensions for cjs/esm builds

Open danielroe opened this issue 3 years ago • 4 comments

Summary

This PR proposes using .cjs and .mjs instead of the current .js extensions. That will allow usage of the @vue packages in a native Node module context.

Example

old new
vue.cjs.js vue.cjs
vue.prod.cjs.js vue.prod.cjs
vue.esm-browser.js vue.esm-browser.mjs
vue.esm-browser.prod.js vue.esm-browser.prod.mjs
vue.runtime.esm-browser.js vue.runtime.esm-browser.mjs
vue.runtime.esm-browser.prod.js vue.runtime.esm-browser.prod.mjs
vue.esm-bundler.js vue.esm-bundler.mjs
vue.runtime.esm-bundler.js vue.runtime.esm-bundler.mjs
vue.global.js vue.global.js
vue.global.prod.js vue.global.prod.js
vue.runtime.global.prod.js vue.runtime.global.prod.js
vue.runtime.global.js vue.runtime.global.js

Notes

  • This is a proposal and I'm happy to take guidance on preferred filenames or behaviour.
  • As is, this is a breaking change as it changes the packaging expectations. If needed I can add stubs to re-export these new outputs.
  • See also https://github.com/vuejs/vue-router-next/pull/1157 and https://github.com/vuejs/vue-class-component/pull/571

Background issue

This will improve support for use of vue dependencies in native node esm contexts.

danielroe avatar Oct 18 '21 14:10 danielroe