fix: interop of cjs with_esModule is consistent with rollup#16437
fix: interop of cjs with_esModule is consistent with rollup#16437XiSenao wants to merge 4 commits intovitejs:mainfrom
_esModule is consistent with rollup#16437Conversation
|
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
02d6402 to
aeaf129
Compare
|
/ecosystem-ci run |
rollup._esModule is consistent with rollup
|
📝 Ran ecosystem CI on
✅ analogjs, astro, histoire, ladle, laravel, marko, previewjs, quasar, qwik, rakkas, remix, sveltekit, unocss, vike, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-pages, vite-plugin-react-swc, vite-plugin-svelte, vite-plugin-vue, vite-setup-catalogue, vitepress, vitest |
|
I wonder if the Rollup behaviour is correct though. For consistency with Rollup, I'm ok if we want to go ahead with this first, but I think we should re-evaluate if this is the correct behaviour. |
|
About Nuxt, it is also failing in main right now. |
|
I think the behavior of |
|
Given that we cannot support both Node's way and Babel's way, I think it's a good middle-ground. It seems it was discussed at rollup/plugins#537. |
| } | ||
| // prettier-ignore | ||
| const interopHelper = (m: any) => m?.__esModule ? m : { ...(typeof m === 'object' && !Array.isArray(m) || typeof m === 'function' ? m : {}), default: m } | ||
| const interopHelper = (m: any) => m?.__esModule && Object.prototype.hasOwnProperty.call(m, 'default') ? m : { ...(typeof m === 'object' && !Array.isArray(m) || typeof m === 'function' ? m : {}), default: m } |
There was a problem hiding this comment.
Let's go ahead with this then to keep dev/build consistent for now. I think we should also add a TODO comment here to revisit this later in Vite 6.
|
Closing as this was fixed in Vite 8 beta. |
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Description
@babel/standalone#16435CJS packages with
__esModulerequire consistent interop behavior withrollupduring development phase.