You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've setup a kinda config based routing system on Next.js (so we can use less time refactoring all our files when you change your preview...). We want to use some data from here to i.e. give a nice preview of the path in the slug or add a "copy" link to the frontend URL.
When doing this and running cd sanity && dotenv -e ../.env -- sanity schema extract --path ../schema.json --enforce-required-fields it fails and produces an error:
✖ Failed to extract schema, with enforced required fields
/project/workspace/node_modules/.pnpm/next-safe-action@7.0.2_next@14.2.1_react-dom@18.2.0_react@18.2.0_zod@3.23.8/node_modules/next-safe-action/dist/hooks.mjs:4
import { isNotFoundError } from "next/dist/client/components/not-found.js";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.newLoader [as .mjs] (/project/workspace/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.21.5/node_modules/esbuild-register/dist/node.js:2262:9)
at Object.<anonymous> (/project/workspace/app/client.component.tsx:2:27)
ELIFECYCLE Command failed with exit code 1.
Note that this seems to have started happening after we began to use next-safe-action so it might be the problem is there?
Would hope that we can get it to work as the next-safe-actions is quite useful :)
Which versions of Sanity are you using?
@sanity/cli (global) 3.47.1 (up to date)
sanity 3.47.1 (up to date)
What operating system are you using?
Sandbox (?)
Which versions of Node.js / npm are you running?
9.8.1
v20.9.0
Additional context
In our actual project we are not getting this exact error but something similar:
/Users/sigurdheggemsnes/Documents/GitHub/home-start/node_modules/.pnpm/next-safe-action@7.0.2_next@14.2.3_react-dom@18.3.1_react@18.3.1_zod@3.23.8/node_modules/next-safe-action/dist/index.mjs:2
import { validate } from "@typeschema/main";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.newLoader [as .mjs] (~/Documents/GitHub/home-start/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.21.4/node_modules/esbuild-register/dist/node.js:2262:9)
at Object.<anonymous> (~/Documents/GitHub/home-start/src/server/actions/safe-action.ts:1:40)
The text was updated successfully, but these errors were encountered:
Describe the bug
We've setup a kinda config based routing system on Next.js (so we can use less time refactoring all our files when you change your preview...). We want to use some data from here to i.e. give a nice preview of the path in the slug or add a "copy" link to the frontend URL.
When doing this and running
cd sanity && dotenv -e ../.env -- sanity schema extract --path ../schema.json --enforce-required-fields
it fails and produces an error:Note that this seems to have started happening after we began to use
next-safe-action
so it might be the problem is there?To Reproduce
Steps to reproduce the behavior:
pnpm typegen
in the console.Expected behavior
Would hope that we can get it to work as the next-safe-actions is quite useful :)
Which versions of Sanity are you using?
@sanity/cli (global) 3.47.1 (up to date)
sanity 3.47.1 (up to date)
What operating system are you using?
Sandbox (?)
Which versions of Node.js / npm are you running?
9.8.1
v20.9.0
Additional context
In our actual project we are not getting this exact error but something similar:
The text was updated successfully, but these errors were encountered: