Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to deploy changes to the Sanity schemas and deploy. #284

Open
cristinallamas opened this issue Sep 20, 2024 · 1 comment
Open

Unable to deploy changes to the Sanity schemas and deploy. #284

cristinallamas opened this issue Sep 20, 2024 · 1 comment

Comments

@cristinallamas
Copy link

Describe the bug

I seem to be unable to deploy the changes to the sanity schema from my local site

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'https://github.com/sanity-io/template-nextjs-personal-website'
  2. Click on the deploy to Vercel button
  3. Follow instructions and create sanity project for it
  4. run sanity build or sanity deploy and get the following error
 npx sanity build       



Including the following environment variables as part of the JavaScript bundle:
- SANITY_STUDIO_DATASET
- SANITY_STUDIO_PROJECT_ID

✅ Clean output folder (5ms)
sanity.config.ts (1:0) Error when using sourcemap for reporting an error: Can't resolve original location of error.
❌️ Build Sanity Studio

Error: [vite]: Rollup failed to resolve import "@/sanity/lib/api" from "/nextjs-personal-website-site/sanity.config.ts".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
    at viteWarn (file://~/nextjs-personal-website-site/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48216:27)
    at onwarn (~/nextjs-personal-website-site/node_modules/@vitejs/plugin-react/dist/index.cjs:258:9)
    at onRollupWarning (file://~/nextjs-personal-website-site/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:48245:9)
    at onwarn (file://~/nextjs-personal-website-site/node_modules/vite/dist/node/chunks/dep-41cf5ffd.js:47976:13)
    at file://~/nextjs-personal-website-site/node_modules/rollup/dist/es/shared/node-entry.js:24276:13
    at Object.logger [as onLog] (file://~/nextjs-personal-website-site/node_modules/rollup/dist/es/shared/node-entry.js:25950:9)
    at ModuleLoader.handleInvalidResolvedId (file://~/nextjs-personal-website-site/node_modules/rollup/dist/es/shared/node-entry.js:24862:26)
    at file://~/nextjs-personal-website-site/node_modules/rollup/dist/es/shared/node-entry.js:24822:26

Which versions of Sanity are you using?

Run sanity versions in the terminal and copy-paste the result here.

@sanity/cli (global)        3.57.4 (up to date)
@sanity/demo                 2.0.0 (up to date)
@sanity/icons                3.4.0 (up to date)
@sanity/image-url            1.0.2 (up to date)
@sanity/preview-url-secret  1.6.21 (up to date)
@sanity/react-loader        1.10.7 (up to date)
@sanity/ui                   2.8.9 (up to date)
@sanity/vision              3.57.4 (up to date)
sanity                      3.57.4 (up to date)

What operating system are you using?
OSX

Which versions of Node.js / npm are you running?

Run npm -v && node -v in the terminal and copy-paste the result here.

10.2.3
v18.19.0

@pedroalmeida415
Copy link

I was going through this same problem and manage to fix it by changing sanity.cli.ts to:

export default defineCliConfig({
  api: { projectId, dataset },
  vite: {
    resolve: {
      alias: {
        '@/': `${resolve(__dirname, '.', 'src')}/`
      }
    }
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants