@prismicio/client export error deploying to Netlify

I have created a static Astro site that pulls from Prismic, and I have followed the Astro docs to deploy as a static site to Netlify. However, when I try to deploy to Netlify, I get the following error message, and the build fails:

3:04:15 PM:  generating static routes 
3:04:15 PM:  error   The requested module '@prismicio/client' does not provide an export named 'default'
3:04:15 PM:     at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
3:04:15 PM:     at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
3:04:15 PM:     at async Promise.all (index 0)
3:04:15 PM:     at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
3:04:15 PM:     at async generatePages (file:///opt/build/repo/node_modules/astro/dist/core/build/generate.js:70:20)
3:04:15 PM:     at async staticBuild (file:///opt/build/repo/node_modules/astro/dist/core/build/static-build.js:68:7)
3:04:15 PM:     at async AstroBuilder.build (file:///opt/build/repo/node_modules/astro/dist/core/build/index.js:83:5)
3:04:15 PM:     at async AstroBuilder.run (file:///opt/build/repo/node_modules/astro/dist/core/build/index.js:123:7)
3:04:15 PM:     at async build (file:///opt/build/repo/node_modules/astro/dist/core/build/index.js:22:3)
3:04:15 PM:     at async runCommand (file:///opt/build/repo/node_modules/astro/dist/cli/index.js:138:14)

Hello @steve1, I'm not sure what exactly is breaking there, but from other posts online I can see that this can be solved by updating the setup of some of your exports. Take this example:

3:04:15 PM: error The requested module '@prismicio/client' does not provide an export named 'default'

Yes, you are correct. I had to fix my import of @prismicio/client from

import Prismic from '@prismicio/client'

to

import * as prismic from '@prismicio/client

1 Like