Open sagerb opened 5 years ago
I also have this issue, and believe this behavior should be fixed in vue-moment.
For me, setting the alias to to the ES module node_modules/vue-moment/dist/vue-moment.es.js
allowed my configuration to import the moment
code only once and keep the vue-moment
slice small with only one step. (No need for deduplication.)
Yeah, this makes sense. Is this what the 'module' field in the package.json should be used for? If so, this should be an easy fix?
Within an existing project which uses webpack, yarn and moment.js, I recently added vue-moment as a dependency. Using webpack's bundle analysis, I quickly saw that the size of vue-moment was as big as moment itself.
I believe this to be occurring because webpack auto-resolves the import of
vue-moment
by examing the filenode_modules/vue-moment/package.json
. This file contains an entry for "main" which points to the copy of vue-moment.js within the dist folder, which continues to have the moment code "inline" (and does not match up with the conditional inclusion present within thenode_modules/vue-moment/vue-moment.js
file.While I can resolve this using a combination of:
yarn-deduplicate
)I don't believe I should have to do this in order to minimize the footprint of vue-moment in my production bundle.
Have I discovered an issue or is this intentional by design?