-
Notifications
You must be signed in to change notification settings - Fork 710
Description
Reproduction link or steps
https://github.com/Jinjiang/reproductions/tree/vite8-external-20260216
How to reproduce:
pnpm install
pnpm devsee the browser console:
// vite 7 works
ƒ MDXContent(props = {}) {
const { wrapper: MDXLayout } = props.components || {};
return MDXLayout ? jsxRuntimeExports.jsx(MDXLayout, {
...props,
children: jsxRuntimeExports.jsx(_createMdxCon…
// vite 8 doesn't
foo8.umd.js:210 Uncaught (in promise) ReferenceError: require is not defined
What is expected?
The require('react') should somehow be linked to globalThis.React like rollup does in Vite 7 but it didn't.
What is actually happening?
It keeps require('react') in the source code which caused the browser runtime error.
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (10) arm64 unknown
Memory: 3.82 GB / 7.64 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 22.14.0 - /home/jinjiang/.volta/tools/image/node/22.14.0/bin/node
npm: 11.6.4 - /home/jinjiang/.volta/tools/image/npm/11.6.4/bin/npm
pnpm: 10.28.2 - /home/jinjiang/.volta/bin/pnpm
Browsers:
Chromium: 144.0.7559.132
npmPackages:
rolldown: 1.0.0-rc.2 => 1.0.0-rc.2Any additional comments?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels