-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Duplicate module bundles when optimized dependencies are reloaded during build #9171
Comments
When I ran
instead. Prebundling also seem to happen many times, as I'm assuming the timeout is shorter than each newly discovered dependency 🤔 Seems like there may be a race condition somewhere. |
This comment was marked as duplicate.
This comment was marked as duplicate.
memo: Reproduction project updated. This issue still seems to be unresolved in v.3.1.1 |
Any known workaround for this? I consistently get this for
The specific lodash import it is changes from build to build... but it's always some lodash import. The imports are of the form: Edit: using vite 3.1.8, here is some more output --
|
me too |
The same problem occurred to me, but I gave up reporting the bug because I didn't know how to reproduce( |
Hello, I also met this problem, may I ask if there is a solution now |
My workaround is to run |
Another workaround: I added the specific duplicated node_module to the |
I have the same problem in my very large project, this results in a very large bundle, this is the output of my compilation with the "duplicate check code" described in the post: Duplicated module found:
/app/node_modules/react/cjs/react-jsx-runtime.production.min.js?commonjs-exports
/app/node_modules/react/cjs/react-jsx-runtime.production.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/react/index.js?commonjs-module
/app/node_modules/react/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/react/cjs/react.production.min.js?commonjs-exports
/app/node_modules/react/cjs/react.production.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/axios/lib/axios.js?commonjs-module
/app/node_modules/axios/lib/axios.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/createActions.js?commonjs-exports
/app/node_modules/redux-arc/lib/createActions.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/utils.js?commonjs-exports
/app/node_modules/redux-arc/lib/utils.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/createTypes.js?commonjs-exports
/app/node_modules/redux-arc/lib/createTypes.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/createCreators.js?commonjs-exports
/app/node_modules/redux-arc/lib/createCreators.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/fsaActionCreatorFactory.js?commonjs-exports
/app/node_modules/redux-arc/lib/fsaActionCreatorFactory.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/apiActionCreatorFactory.js?commonjs-exports
/app/node_modules/redux-arc/lib/apiActionCreatorFactory.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/parseUrl.js?commonjs-exports
/app/node_modules/redux-arc/lib/parseUrl.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/validateConfig.js?commonjs-exports
/app/node_modules/redux-arc/lib/validateConfig.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/toExternalTypes.js?commonjs-exports
/app/node_modules/redux-arc/lib/toExternalTypes.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/toApiExternalType.js?commonjs-exports
/app/node_modules/redux-arc/lib/toApiExternalType.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/createAsyncMiddleware.js?commonjs-exports
/app/node_modules/redux-arc/lib/createAsyncMiddleware.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/requestMiddlewares.js?commonjs-exports
/app/node_modules/redux-arc/lib/requestMiddlewares.js?commonjs-proxy
Duplicated module found:
/app/node_modules/redux-arc/lib/createReducers.js?commonjs-exports
/app/node_modules/redux-arc/lib/createReducers.js?commonjs-proxy
Duplicated module found:
/app/node_modules/history/umd/history.production.min.js?commonjs-module
/app/node_modules/history/umd/history.production.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/react-dom/index.js?commonjs-module
/app/node_modules/react-dom/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/react-dom/cjs/react-dom.production.min.js?commonjs-exports
/app/node_modules/react-dom/cjs/react-dom.production.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/scheduler/index.js?commonjs-module
/app/node_modules/scheduler/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/scheduler/cjs/scheduler.production.min.js?commonjs-exports
/app/node_modules/scheduler/cjs/scheduler.production.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/use-sync-external-store/shim/index.js?commonjs-module
/app/node_modules/use-sync-external-store/shim/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js?commonjs-exports
/app/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js?commonjs-exports
/app/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/react-is/index.js?commonjs-module
/app/node_modules/react-is/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/react-is/cjs/react-is.production.min.js?commonjs-exports
/app/node_modules/react-is/cjs/react-is.production.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/react-redux/node_modules/react-is/cjs/react-is.production.min.js?commonjs-exports
/app/node_modules/react-redux/node_modules/react-is/cjs/react-is.production.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/htmlparser2/lib/index.js?commonjs-exports
/app/node_modules/htmlparser2/lib/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/htmlparser2/lib/Parser.js?commonjs-exports
/app/node_modules/htmlparser2/lib/Parser.js?commonjs-proxy
Duplicated module found:
/app/node_modules/htmlparser2/lib/Tokenizer.js?commonjs-exports
/app/node_modules/htmlparser2/lib/Tokenizer.js?commonjs-proxy
Duplicated module found:
/app/node_modules/entities/lib/decode.js?commonjs-exports
/app/node_modules/entities/lib/decode.js?commonjs-proxy
Duplicated module found:
/app/node_modules/entities/lib/generated/decode-data-html.js?commonjs-exports
/app/node_modules/entities/lib/generated/decode-data-html.js?commonjs-proxy
Duplicated module found:
/app/node_modules/entities/lib/generated/decode-data-xml.js?commonjs-exports
/app/node_modules/entities/lib/generated/decode-data-xml.js?commonjs-proxy
Duplicated module found:
/app/node_modules/entities/lib/decode_codepoint.js?commonjs-exports
/app/node_modules/entities/lib/decode_codepoint.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domhandler/lib/index.js?commonjs-exports
/app/node_modules/domhandler/lib/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domelementtype/lib/index.js?commonjs-exports
/app/node_modules/domelementtype/lib/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domhandler/lib/node.js?commonjs-exports
/app/node_modules/domhandler/lib/node.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domutils/lib/index.js?commonjs-exports
/app/node_modules/domutils/lib/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domutils/lib/stringify.js?commonjs-exports
/app/node_modules/domutils/lib/stringify.js?commonjs-proxy
Duplicated module found:
/app/node_modules/dom-serializer/lib/index.js?commonjs-exports
/app/node_modules/dom-serializer/lib/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/entities/lib/index.js?commonjs-exports
/app/node_modules/entities/lib/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/entities/lib/encode.js?commonjs-exports
/app/node_modules/entities/lib/encode.js?commonjs-proxy
Duplicated module found:
/app/node_modules/entities/lib/generated/encode-html.js?commonjs-exports
/app/node_modules/entities/lib/generated/encode-html.js?commonjs-proxy
Duplicated module found:
/app/node_modules/entities/lib/escape.js?commonjs-exports
/app/node_modules/entities/lib/escape.js?commonjs-proxy
Duplicated module found:
/app/node_modules/dom-serializer/lib/foreignNames.js?commonjs-exports
/app/node_modules/dom-serializer/lib/foreignNames.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domutils/lib/traversal.js?commonjs-exports
/app/node_modules/domutils/lib/traversal.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domutils/lib/manipulation.js?commonjs-exports
/app/node_modules/domutils/lib/manipulation.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domutils/lib/querying.js?commonjs-exports
/app/node_modules/domutils/lib/querying.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domutils/lib/legacy.js?commonjs-exports
/app/node_modules/domutils/lib/legacy.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domutils/lib/helpers.js?commonjs-exports
/app/node_modules/domutils/lib/helpers.js?commonjs-proxy
Duplicated module found:
/app/node_modules/domutils/lib/feeds.js?commonjs-exports
/app/node_modules/domutils/lib/feeds.js?commonjs-proxy
Duplicated module found:
/app/node_modules/is-plain-object/dist/is-plain-object.js?commonjs-exports
/app/node_modules/is-plain-object/dist/is-plain-object.js?commonjs-proxy
Duplicated module found:
/app/node_modules/parse-srcset/src/parse-srcset.js?commonjs-module
/app/node_modules/parse-srcset/src/parse-srcset.js?commonjs-proxy
Duplicated module found:
/app/node_modules/picocolors/picocolors.browser.js?commonjs-module
/app/node_modules/picocolors/picocolors.browser.js?commonjs-proxy
Duplicated module found:
/app/node_modules/postcss/lib/symbols.js?commonjs-exports
/app/node_modules/postcss/lib/symbols.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.object.assign.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.object.assign.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_global.js?commonjs-module
/app/node_modules/core-js/library/modules/_global.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_core.js?commonjs-module
/app/node_modules/core-js/library/modules/_core.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_shared.js?commonjs-module
/app/node_modules/core-js/library/modules/_shared.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_object-gops.js?commonjs-exports
/app/node_modules/core-js/library/modules/_object-gops.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.object.define-property.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.object.define-property.js?commonjs-proxy
Duplicated module found:
/app/node_modules/babel-runtime/helpers/typeof.js?commonjs-exports
/app/node_modules/babel-runtime/helpers/typeof.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.string.iterator.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.string.iterator.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_wks.js?commonjs-module
/app/node_modules/core-js/library/modules/_wks.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/web.dom.iterable.js?commonjs-exports
/app/node_modules/core-js/library/modules/web.dom.iterable.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_wks-ext.js?commonjs-exports
/app/node_modules/core-js/library/modules/_wks-ext.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.symbol.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.symbol.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_meta.js?commonjs-module
/app/node_modules/core-js/library/modules/_meta.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_object-gopn-ext.js?commonjs-exports
/app/node_modules/core-js/library/modules/_object-gopn-ext.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_object-gopn.js?commonjs-exports
/app/node_modules/core-js/library/modules/_object-gopn.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/_object-gopd.js?commonjs-exports
/app/node_modules/core-js/library/modules/_object-gopd.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.object.to-string.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.object.to-string.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es7.symbol.async-iterator.js?commonjs-exports
/app/node_modules/core-js/library/modules/es7.symbol.async-iterator.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es7.symbol.observable.js?commonjs-exports
/app/node_modules/core-js/library/modules/es7.symbol.observable.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.object.set-prototype-of.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.object.set-prototype-of.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.object.create.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.object.create.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.object.get-prototype-of.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.object.get-prototype-of.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.object.get-own-property-descriptor.js?commonjs-proxy
Duplicated module found:
/app/node_modules/add-dom-event-listener/lib/EventObject.js?commonjs-module
/app/node_modules/add-dom-event-listener/lib/EventObject.js?commonjs-proxy
Duplicated module found:
/app/node_modules/add-dom-event-listener/lib/EventBaseObject.js?commonjs-module
/app/node_modules/add-dom-event-listener/lib/EventBaseObject.js?commonjs-proxy
Duplicated module found:
/app/node_modules/core-js/library/modules/es6.array.from.js?commonjs-exports
/app/node_modules/core-js/library/modules/es6.array.from.js?commonjs-proxy
Duplicated module found:
/app/node_modules/performance-now/lib/performance-now.js?commonjs-module
/app/node_modules/performance-now/lib/performance-now.js?commonjs-proxy
Duplicated module found:
/app/node_modules/html-dom-parser/lib/client/utilities.js?commonjs-exports
/app/node_modules/html-dom-parser/lib/client/utilities.js?commonjs-proxy
Duplicated module found:
/app/node_modules/html-dom-parser/lib/client/constants.js?commonjs-exports
/app/node_modules/html-dom-parser/lib/client/constants.js?commonjs-proxy
Duplicated module found:
/app/node_modules/react-property/lib/index.js?commonjs-exports
/app/node_modules/react-property/lib/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/react-property/lib/possibleStandardNamesOptimized.js?commonjs-exports
/app/node_modules/react-property/lib/possibleStandardNamesOptimized.js?commonjs-proxy
Duplicated module found:
/app/node_modules/style-to-js/cjs/index.js?commonjs-exports
/app/node_modules/style-to-js/cjs/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/style-to-object/index.js?commonjs-module
/app/node_modules/style-to-object/index.js?commonjs-proxy
Duplicated module found:
/app/node_modules/style-to-js/cjs/utilities.js?commonjs-exports
/app/node_modules/style-to-js/cjs/utilities.js?commonjs-proxy
Duplicated module found:
/app/node_modules/lodash/lodash.min.js?commonjs-module
/app/node_modules/lodash/lodash.min.js?commonjs-proxy
Duplicated module found:
/app/node_modules/lodash/fp/_mapping.js?commonjs-exports
/app/node_modules/lodash/fp/_mapping.js?commonjs-proxy |
I have exactly the same problem |
#13906 probably fixed this issue? |
Describe the bug
Duplicate module bundles when optimized dependencies are reloaded during build.
It was very hard to reproduce this bug...it took a long time.
It depends on a very sensitive behavior and may not always be reproduced.
If you can't reproduce it, try increasing the file or increasing the delay.
Dependencies are not as important as huge dependencies just needed to be.
Please look at vite.config.ts.
npm run build
output:For example, when this bug occurs for
react.development.js
, it causes an error because the context of the hooks is duplicated and cannot be referenced correctly:Reproduction
https://stackblitz.com/edit/vitejs-vite-8vghhj?file=vite.config.ts
System Info
Used Package Manager
npm
Logs
verbose log in terminal
Validations
The text was updated successfully, but these errors were encountered: