Skip to content

Conversation

@zhangyuang
Copy link

@zhangyuang zhangyuang commented Nov 2, 2021

export default has many bugs when mixed with commonjs, vuex use export default object in vuex.cjs.js which behavior is not like vue-router-next. It cause the below code cannot get correct value in the lastest vite version

import { createStore } from 'vuex'
console.log(createStore === undefined)

@zhangyuang
Copy link
Author

vuex.cjs.js export code

image

@zhangyuang
Copy link
Author

vue-router-next export code
image

@zhangyuang
Copy link
Author

zhangyuang commented Nov 2, 2021

cc @kiaking , the problem affect users who used the latest vite in ssr

Copy link
Member

@haoqunjiang haoqunjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, vue-router has named exports in v4 cjs build.
So I think it would be more consistent and intuitive if vuex includes them too.

https://unpkg.com/browse/vue-router@4.0.12/dist/vue-router.cjs.js#L3439
/cc @kiaking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants