Overview
Using this module sometimes causes an error when running the dev server:
ERROR [worker reload] [worker init] ../.nuxt/dev/index.mjs failed
Related to nuxt/nuxt#29882, which I understand is likely an upstream/nitro issue. I wanted to open this here for visibility and see if anyone else could share insight in the context of this module. I'll continue to investigate to see if I can open an issue/PR in the nitropack repo.
The culprit seems to be when importing useSanity in a server handler. With this import removed, I find the consuming app runs consistently. Likewise I've found disabling visual editing (which therefore means addServerHandler is never called) resolves the issue.
It's a bit hard to pin down the exact reason. I suppose it's related to how Nitro is resolving virtual imports when using #imports, and results seem to vary depending on the location of those imports. For example running the playground app in this repo seems to work fine, but building the module locally and linking it using pnpm triggers the error (so long as these server handlers are called).
Version
module: 1.12.2
nuxt: 3.14.159
Reproduction
What is expected?
Importing useSanity via #imports in a server handler should work.
What is actually happening?
Importing useSanity via #imports in a server handler is sometimes causing nuxt dev to fail.
Steps to reproduce
Install the module and enable visual editing in a Nuxt app using Nitropack >2.10.0.
Additional information
Checklist
Overview
Using this module sometimes causes an error when running the dev server:
ERROR [worker reload] [worker init] ../.nuxt/dev/index.mjs failedRelated to nuxt/nuxt#29882, which I understand is likely an upstream/nitro issue. I wanted to open this here for visibility and see if anyone else could share insight in the context of this module. I'll continue to investigate to see if I can open an issue/PR in the nitropack repo.
The culprit seems to be when importing
useSanityin a server handler. With this import removed, I find the consuming app runs consistently. Likewise I've found disabling visual editing (which therefore meansaddServerHandleris never called) resolves the issue.It's a bit hard to pin down the exact reason. I suppose it's related to how Nitro is resolving virtual imports when using
#imports, and results seem to vary depending on the location of those imports. For example running the playground app in this repo seems to work fine, but building the module locally and linking it usingpnpmtriggers the error (so long as these server handlers are called).Version
module:
1.12.2nuxt:
3.14.159Reproduction
What is expected?
Importing
useSanityvia#importsin a server handler should work.What is actually happening?
Importing
useSanityvia#importsin a server handler is sometimes causingnuxt devto fail.Steps to reproduce
Install the module and enable visual editing in a Nuxt app using Nitropack
>2.10.0.Additional information
Checklist