-
Notifications
You must be signed in to change notification settings - Fork 946
Description
What versions & operating system are you using?
System:
OS: Windows 11 10.0.26200
CPU: (32) x64 AMD Ryzen 9 9950X 16-Core Processor
Memory: 28.76 GB / 61.66 GB
Binaries:
Node: 22.17.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.22 - ~\AppData\Local\pnpm\yarn.CMD
npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
pnpm: 10.13.1 - ~\AppData\Local\pnpm\pnpm.CMD
npmPackages:
@cloudflare/vite-plugin: ^1.11.0 => 1.11.0
wrangler: ^4.27.0 => 4.27.0
Please provide a link to a minimal reproduction
https://github.com/yume-chan/cloudflare-incorrect-exports
Describe the Bug
When using dynamic imports (await import(...)
), Rollup might move imports used by both the entrypoint module and the dynamic module to the entrypoint bundle itself (see yume-chan/cloudflare-incorrect-exports@0826b5e), causing the worker to fail to start.
If workerd strictly validates entrypoint exports, @cloudflare/vite-plugin
should set environments.<worker>.build.rollupOptions.preserveEntrySignatures
(https://rollupjs.org/configuration-options/#preserveentrysignatures) to "strict"
.
(Rollup's default value is "exports-only"
which doesn't allow adding extra exports, but it was overridden by Vite at https://github.com/vitejs/vite/blob/95927d9c0ba1cb0b3bd8c900f039c099f8e29f90/packages/vite/src/node/build.ts#L582-L583)
Please provide any relevant error logs
┖[D:\dev\sandbox\my-react-app]> pnpm preview
> [email protected] preview D:\dev\sandbox\my-react-app
> pnpm run build && vite preview
> [email protected] build D:\dev\sandbox\my-react-app
> tsc -b && vite build
vite v7.0.6 building SSR bundle for production...
✓ 3 modules transformed.
dist/my_react_app/.vite/manifest.json 0.35 kB
dist/my_react_app/wrangler.json 1.09 kB
dist/my_react_app/assets/b-DAf2TwjV.js 0.09 kB
dist/my_react_app/index.js 0.39 kB
✓ built in 57ms
vite v7.0.6 building for production...
✓ 33 modules transformed.
dist/client/index.html 0.46 kB │ gzip: 0.30 kB
dist/client/assets/react-CHdo91hT.svg 4.13 kB │ gzip: 2.05 kB
dist/client/assets/index-Di39QQwc.css 1.45 kB │ gzip: 0.72 kB
dist/client/assets/index-Bgd8jq1c.js 192.25 kB │ gzip: 61.24 kB
✓ built in 434ms
➜ Local: http://localhost:4173/
➜ Network: use --host to expose
➜ press h + enter to show help
service core:user:my-react-app: Uncaught TypeError: Incorrect type for map entry 'A': the provided value is not of type 'function or ExportedHandler'.
D:\dev\sandbox\my-react-app\node_modules\.pnpm\[email protected]\node_modules\miniflare\dist\src\index.js:25299
throw new MiniflareCoreError(
^
MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
at #assembleAndUpdateConfig (D:\dev\sandbox\my-react-app\node_modules\.pnpm\[email protected]\node_modules\miniflare\dist\src\index.js:25299:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Mutex.runWith (D:\dev\sandbox\my-react-app\node_modules\.pnpm\[email protected]\node_modules\miniflare\dist\src\index.js:6236:48) {
code: 'ERR_RUNTIME_FAILURE',
cause: undefined
}
Node.js v22.17.1
ELIFECYCLE Command failed with exit code 1.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status