Open jvbianchi opened 4 months ago
Are you force resolving unenv to nighyly version in your Nitro project?
No , I just install nuxt using Bun with this command:
bun create cloudflare@latest my-nuxt-app -- --framework=nuxt
You have mentioned unenv-nightly version 1.10.0-1717606461.a117952
how it is there?
Can you please share npm why unenv
/ pnpm why unenv
(depending on your package manager)
I just saw, It's one of wrangler's depencies:
wrangler@3.60.3:
version "3.60.3"
resolved "https://registry.npmjs.org/wrangler/-/wrangler-3.60.3.tgz"
integrity sha512-a6zn/KFnYaYp3nxJR/aP0TeaBvJDkrrfI89KoxUtx28H7zpya/5/VLu3CxQ3PRspEojJGF0s6f3/pddRy3F+BQ==
dependencies:
unenv "npm:unenv-nightly@1.10.0-1717606461.a117952"
nanoid "^3.3.3"
esbuild "0.17.19"
resolve "^1.22.8"
chokidar "^3.5.3"
miniflare "3.20240610.0"
selfsigned "^2.0.1"
source-map "0.6.1"
blake3-wasm "^2.1.5"
xxhash-wasm "^1.0.1"
path-to-regexp "^6.2.0"
resolve.exports "^2.0.2"
"@cloudflare/kv-asset-handler" "0.3.2"
"@esbuild-plugins/node-globals-polyfill" "^0.2.3"
"@esbuild-plugins/node-modules-polyfill" "^0.2.2"
optionalDependencies:
fsevents "~2.3.2"
It was changed in this commit: https://github.com/cloudflare/workers-sdk/commit/1e68fe5448ffa4d0551dc7255405983c329235c8
Interesting. Is this some kind of weird npm package hoisting issue?
I've just tested the repro with pnpm and it works just fine for me, and I see
$ pnpm list --depth=20 unenv unenv-nightly
Legend: production dependency, optional only, dev only
nuxt-app /my-nuxt-app2
dependencies:
nuxt 3.12.2
├─┬ @nuxt/vite-builder 3.12.2
│ ├─┬ h3 1.11.1
│ │ └── unenv 1.9.0
│ └── unenv 1.9.0
├─┬ h3 1.11.1
│ └── unenv 1.9.0
├─┬ nitropack 2.9.6
│ ├─┬ h3 1.11.1
│ │ └── unenv 1.9.0
│ ├─┬ listhen 1.7.2
│ │ └─┬ h3 1.11.1
│ │ └── unenv 1.9.0
│ ├── unenv 1.9.0
│ └─┬ unstorage 1.10.2
│ ├─┬ h3 1.11.1
│ │ └── unenv 1.9.0
│ └─┬ listhen 1.7.2
│ └─┬ h3 1.11.1
│ └── unenv 1.9.0
├── unenv 1.9.0
└─┬ unstorage 1.10.2
└─┬ h3 1.11.1
└── unenv 1.9.0
devDependencies:
h3 1.11.1
└── unenv 1.9.0
wrangler 3.60.3
└── unenv-nightly 1.10.0-1717606461.a117952
Could you try to use pnpm or somehow tell bun not to hoist packages (I'm not a bun user, but I hope there is a way to do that).
@pi0 we could try to bundle unenv-nightly into Wrangler but it's tricky because unenv has built-time and runtime component and we currently get the runtime-component from the npm package (the built-time part is already bundled into the wrangler bundle).
When I install unenv as a dev dependency (version 1.9.0) the error goes way.
@jvbianchi which suggests that bun's package hoisting is the culprit here.
Thanks for report dear @jvbianchi
As you have already figured out, adding latest (1.9.x
) version of unenv to your main project dependencies
, devDependencies
(or resolutions
if those won't work will fix the hoisting issue in your project.
For the followup:
npm:
protocol)You have mentioned
unenv-nightly version 1.10.0-1717606461.a117952
how it is there?Can you please share
npm why unenv
/pnpm why unenv
(depending on your package manager)
I have the same Issue with @nuxtjs/sitemap...
pnpm why unev
:
dependencies:
nuxt 3.13.2
├─┬ @nuxt/vite-builder 3.13.2
│ ├─┬ h3 1.13.0
│ │ └── unenv 1.10.0
│ └── unenv 1.10.0
├─┬ h3 1.13.0
│ └── unenv 1.10.0
├─┬ impound 0.1.0
│ └── unenv 1.10.0
├─┬ nitropack 2.9.7
│ ├─┬ h3 1.13.0
│ │ └── unenv 1.10.0
│ ├─┬ listhen 1.9.0
│ │ └─┬ h3 1.13.0
│ │ └── unenv 1.10.0
│ ├── unenv 1.10.0
│ └─┬ unstorage 1.12.0
│ ├─┬ h3 1.13.0
│ │ └── unenv 1.10.0
│ └─┬ listhen 1.9.0
│ └─┬ h3 1.13.0
│ └── unenv 1.10.0
└── unenv 1.10.0
devDependencies:
@nuxtjs/sitemap 6.1.2
└─┬ h3-compression 0.3.2
└─┬ h3 1.13.0 peer
└── unenv 1.10.0
Environment
cloudflare pages
Reproduction
try to deploy Nuxt to cloudflare pages using the /server/api/hello.ts folder with a simple test
Describe the bug
"default" is not exported by "node_modules/unenv/runtime/polyfill/process.mjs"
Additional context
unenv-nightly version 1.10.0-1717606461.a117952
Logs