-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: use cjs/mjs extensions for cjs/esm builds #1157
Conversation
Thanks a lot for this! I think we should align with Vue. Regarding the changes, it's IMO okay to release this in 4.1.0 with information about the changes necessary for the user. |
Published and testable under the |
A repo with vite & vue cli examples using the published version: https://github.com/danielroe/vue-esm-test and https://github.com/danielroe/vue-esm-test/tree/vue-cli. |
5d6ca0d
to
6db89f0
Compare
Co-authored-by: Eduardo San Martin Morote <[email protected]>
Co-authored-by: Eduardo San Martin Morote <[email protected]>
Co-authored-by: Eduardo San Martin Morote <[email protected]>
Co-authored-by: Eduardo San Martin Morote <[email protected]>
Co-authored-by: Eduardo San Martin Morote <[email protected]>
Co-authored-by: Eduardo San Martin Morote <[email protected]>
Summary
This PR proposes using
.cjs
and.mjs
instead of the current.js
extensions. That will allow usage of this library in a native Node module context.Notes
.mjs
/.cjs
files for backwards compatibility.vue
,vue
will also need to provide appropriately named native Node module filenames. (This should not negatively affect existing users who will not be using this module natively anyway.)Background issue
At the moment, importing
vue-router
within an ESM context produces the following error: