prismicio / prismic-client

The official JavaScript + TypeScript client library for Prismic
https://prismic.io/docs/technical-reference/prismicio-client
Apache License 2.0
169 stars 61 forks source link

"@prismicio/client does not provide default export" error deploying to Netlfiy #256

Closed wonder95 closed 2 years ago

wonder95 commented 2 years ago

Versions

Reproduction

Additional Details

Steps to reproduce

What is expected?

Successful site deployment

What is actually happening?

I get the following console error on Netlify

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)

Here is my package.json:

{
  "name": "@example/basics",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro build",
    "preview": "astro preview"
  },
  "devDependencies": {
    "@astrojs/image": "^0.3.4",
    "@astrojs/tailwind": "^0.2.1",
    "@astrojs/vue": "^0.1.4",
    "astro": "^1.0.3",
    "vue": "^3.2.33"
  },
  "dependencies": {
    "@prismicio/client": "^6.5.1",
    "@prismicio/helpers": "^2.3.1",
    "@prismicio/richtext": "^2.1.0"
  }
}
github-actions[bot] commented 2 years ago

You created this issue using the 🚨 Bug report template therefore it has been flagged as such.

Hi there, thank you so much for your contribution!

Following our Maintenance process, we will review your bug report and get back to you next Wednesday. To ensure a smooth review of your issue and avoid unnecessary delays, please make sure your issue include the following:

If you have identified the cause of the bug described in your report and know how to fix it, you're more than welcome to open a pull request addressing it. Check out our quick start guide for a simple contribution process.

If you think your issue is a question (not a bug) and would like quicker support, please close this issue and forward it to an appropriate section on our community forum: https://community.prismic.io

- Prismic Open-Source team

angeloashmore commented 2 years ago

Hi @wonder95, could you provide a code snippet showing how you are using @prismicio/client in your project? Thanks! πŸ™‚

wonder95 commented 2 years ago

@angeloashmore It turns out it was my error. In following some examples I was importing like so

import Prismic from '@prismicio/client`

instead of

import * as prismic from '@prismicio/client'

Once I fixed that, the problem went away.

angeloashmore commented 2 years ago

Awesome! Glad to hear you found a fix. πŸ™‚

If you come any examples from Prismic that use the default export, please let us know and we'll get them updated. πŸ‘