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
.vue
single-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