optimizeDeps.exclude
removes default
property from exports
#10258
Labels
feat: deps optimizer
Esbuild Dependencies Optimization
p3-minor-bug
An edge case that only affects very specific usage (priority)
Describe the bug
When a dependency is added in
optimizeDeps.exclude
, it injects__reExport
during dependency pre-bundling (link) which removesdefault
property.Steps to reproduce:
node_modules/
directory.react
fromoptimizeDeps
.react
imports as external and replaces them with external ESM URLs.node_modules/.vite/deps
for a chunk file that contains// external:react
. It has the following code snippet:__reExport
removesdefault
property from react import:src/index.tsx
. Refresh the webpage, it loads the UI without error.optimizeDeps
and plugin implementation from vite config. Refresh the webpage, it loads the UI without error.theming.esm.js
is trying to accessReact.Component
but it isundefined
becausereact_exports
does not contain"default"
property.Reproduction
https://stackblitz.com/edit/vitejs-vite-u5bre3
System Info
Used Package Manager
npm
Logs
Console Error:
Validations
The text was updated successfully, but these errors were encountered: