Repository navigation
Add Node.js esm entry point - #1872
Merged
Merged
Conversation
kiaking
requested changes
Nov 20, 2020
kiaking
left a comment
Member
There was a problem hiding this comment.
Thanks a lot on the PR! I've tested this at my environment too and it's working. Nice one 👍
I left a comment on not referencing src folder. Please have a look 🙏
kiaking
approved these changes
Nov 22, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a Node.js esm entry point for Vuex. Currently it is already possible to do
on Node 13.2 and up, but unfortunately it's not possible to do
because Node doesn't support named imports from CommonJS (note: it actually does, but only if the imported cjs file adheres to some rules, such as using
exports.mapGetters). This PR adds support for named imports on Node as well.While it is possible to directly use
dist/vuex.esm.js, this PR does not use that file but chooses to use an esm wrapper file as to avoid the dual package hazard.Why?
Node.js now fully supports esm so let's encourage the migration process by improving interoperability of the code we write. I've created this PR in the wake of writing vue-esm-loader which allows importing
.vuesingle-file components on Node without a build step. I noticed that I was unable to test my Vue components because they were usingand hence decided to add this functionality to Vuex.
Related: chaijs/chai#1340