-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
tree shaking not work because of vuex.mjs #1906
Comments
fangbinwei
added a commit
to fangbinwei/vuex
that referenced
this issue
Dec 18, 2020
kiaking
pushed a commit
that referenced
this issue
Jan 25, 2021
kiaking
added a commit
that referenced
this issue
Jan 25, 2021
The fixed is merged. This should be fixed in new release! |
This was referenced Mar 13, 2021
This was referenced Jul 20, 2024
This was referenced Aug 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
4.0.0-rc.2
Reproduction link
https://github.com/fangbinwei/vuex-next-issue
Steps to reproduce
prev state
in dist/main.js to validate if bundle containscreateLogger
vuex/src/plugins/logger.js
Line 33 in bb78857
main.js
output(external vue)
main.js
output(external vue)
What is expected?
drop
createLogger
from the bundleWhat is actually happening?
bundle contains
createLogger
I think tree shaking not work because of two reasons, (I know vuex.mjs wrap vuex.cjs.js because of some rules in node)
default import
Maybe we can do like below
"exports": { ".": { + "module": "./dist/vuex.esm-bundler.js", "require": "./dist/vuex.cjs.js", "import": "./dist/vuex.mjs" }, "./": "./" },
nodejs don't support
module
inexports
, so it can executedist/vuex.mjs
webpack support
module
inexports
, it will usedist/vuex.esm-bundler.js
first if it is valid, since the order of"module"
is in front of the"import"
Moreover
since
vuex.mjs
wrap CommonJS which containsrequire('vue')
and it let vuex doesn't compatiable with webpack externals script, check this issue. Reproduction linkThe text was updated successfully, but these errors were encountered: