We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
4.0.0-rc.2
https://github.com/fangbinwei/vuex-next-issue
prev state
createLogger
vuex/src/plugins/logger.js
Line 33 in bb78857
main.js
// tree shaking not work because of vuex.mjs import {Store} from 'vuex' console.log(Store)
output(external vue)
[webpack-cli] Compilation finished asset main.js 12.1 KiB [emitted] [minimized] (name: main) 2 related assets orphan modules 400 bytes [orphan] 1 module runtime modules 221 bytes 1 module built modules 35.6 KiB [built] ./src/index.js 1 modules 567 bytes [built] [code generated] ./node_modules/vuex/dist/vuex.cjs.js 35 KiB [built] [code generated] external "Vue" 42 bytes [built] [code generated] webpack 5.11.0 compiled successfully in 713 ms ✨ Done in 3.59s.
// tree shaking work import {Store} from 'vuex/dist/vuex.esm-bundler.js' console.log(Store)
[webpack-cli] Compilation finished asset main.js 9.8 KiB [emitted] [minimized] (name: main) 2 related assets orphan modules 35.1 KiB [orphan] 2 modules runtime modules 221 bytes 1 module ./src/index.js 2 modules 35.3 KiB [not cacheable] [built] [code generated] webpack 5.11.0 compiled successfully in 797 ms ✨ Done in 2.47s.
drop createLogger from the bundle
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 in exports, so it can execute dist/vuex.mjs
module
exports
dist/vuex.mjs
webpack support module in exports, it will use dist/vuex.esm-bundler.js first if it is valid, since the order of "module" is in front of the "import"
dist/vuex.esm-bundler.js
"module"
"import"
since vuex.mjs wrap CommonJS which contains require('vue') and it let vuex doesn't compatiable with webpack externals script, check this issue. Reproduction link
vuex.mjs
require('vue')
The text was updated successfully, but these errors were encountered:
fix: webpack bundle with 'vuex.esm-bundler.js'
0f32335
fixes vuejs#1906
fix: webpack bundle with 'vuex.esm-bundler.js' (#1906) (#1907)
aeddf7a
fix #1906
fix: webpack bundle with 'vuex.esm-bundler.js' (#1906)
1dc2d1f
The fixed is merged. This should be fixed in new release!
Sorry, something went wrong.
No branches or pull requests
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: