[Nuxt 3 rc 3 - Cloudflare Preset] ReferenceError: Cannot access '**' before initialization
See original GitHub issueBeen trying to debug this issue for a few days, after I did a upgrade on all the packages. Then now I’m getting reference error, when having built with the Cloudflare preset, and either trying to publish or testing with Miniflare.
In the built file it happens in this area ii={..._,...k,...ii,promises:oi}
, but overall, I don’t have enough knowledge to track down where exactly this stems from. Only found out that it only happens when this module is being used. If I comment out this in the nuxt config module section, everything works as normal.
Posting here as a start, as it’s the closest I’ve gotten to where the error comes from.
Version
- Operating System:
Darwin
- Node Version:
v18.1.0
- Nuxt Version:
3.0.0-rc.3
- Package Manager:
yarn@1.22.18
- Builder:
vite
- User Config:
modules
,nitro
- Runtime Modules:
@nuxtjs/supabase@0.1.14
- Build Modules:
-
Reproduction Link
https://github.com/PhaxeNor/nuxt-supabase-test Make sure to create the .env file
SUPABASE_URL="https://example.supabase.com"
SUPABASE_KEY="<your_key>"
Steps to reproduce
-
Install latest Nuxt 3 dev
^3.0.0-rc.3
and latest supabase module0.1.14
-
Set up according to docs
-
Build using Cloudflare Preset
-
Run with Miniflare/try publish
-
See error in console about ReferenceError
-
Remove
@nuxtjs/supabase
from the nuxt config module section -
Repeat steps 3-4, then see it working.
What is Expected?
Being able to run and use the Supabase module with Cloudflare, as it worked a few weeks ago
What is actually happening?
After setting up a project and adding @nuxtjs/supabase, and setting it up according to the docs, then building using the Cloudflare preset provided with Nuxt3, it throws the ReferenceError when trying to run that build
Full Error
ReferenceError: Cannot access 'ii' before initialization
at ctx (/Users/PhaxeNor/Development/Test/NuxtSupabaseTest/node_modules/unenv/runtime/node/fs/index.mjs:12:6)
at /Users/PhaxeNor/Development/Test/NuxtSupabaseTest/.nuxt/dist/server/server.mjs:12507:32
at Script.runInContext (node:vm:139:12)
at VMScriptRunner.runAsScript (/Users/PhaxeNor/.npm/_npx/46ed1b29b205fa85/node_modules/@miniflare/runner-vm/src/index.ts:25:12)
at VMScriptRunner.run (/Users/PhaxeNor/.npm/_npx/46ed1b29b205fa85/node_modules/@miniflare/runner-vm/src/index.ts:84:12)
at Miniflare.#reload (/Users/PhaxeNor/.npm/_npx/46ed1b29b205fa85/node_modules/@miniflare/core/src/index.ts:737:42)
at Miniflare.getPlugins (/Users/PhaxeNor/.npm/_npx/46ed1b29b205fa85/node_modules/@miniflare/core/src/index.ts:970:5)
at createServer (/Users/PhaxeNor/.npm/_npx/46ed1b29b205fa85/node_modules/@miniflare/http-server/src/index.ts:334:19)
at startServer (/Users/PhaxeNor/.npm/_npx/46ed1b29b205fa85/node_modules/@miniflare/http-server/src/index.ts:420:18)
at main (/Users/PhaxeNor/.npm/_npx/46ed1b29b205fa85/node_modules/miniflare/src/cli.ts:96:5)
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Any update on this ? workaround ? completely blocked on updating cloudflare env to latest nuxt3 @danielroe @pi0
This looks like it’s related how we are mocking
fs
in unenv: https://github.com/unjs/unenv/commit/5ee4115ca87406158bed4b2c2419532c1e311a60Also will need to investigate why
debug
is being inlined, which seems the source of why we’re inliningfs
.cc: @pi0