I am on a Next.js project and when I run npm run build
, I don't get any errors, but when my project is trying to get built on Vercel, I get the following error:
Module '"@prismicio/client"' has no exported member 'Content'
This error is odd because I can definitely see that the file has that exported Content
namespace.
According to the [prismic docs][1], the way I am importing the types is correct, and since it works locally just fine, I wonder if there is something I need to be adding on Vercel to make this happen.
This is how I am using that in one of my files:
import { Content } from '@prismicio/client'
This is my tsconfig.json
file contents:
{
"compilerOptions": {
"baseUrl": ".",
"target": "es6",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"paths": {
"@/*": ["./*"]
}
},
"include": [
"next-env.d.ts",
"react-table-config.d.ts",
"prismicio-types.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.css",
"**.*.js",
"foundations/*.js",
"components/*.js",
"lib/tailwind/colors.js"
],
"exclude": ["node_modules"]
}
This is my package.json
file contents:
{
"name": "project-web",
"private": true,
"scripts": {
"dev": "API_URL=api.sandbox.project-web.com next dev",
"build": "next build",
"export": "next export",
"build:next": "next build && next export -o dist/",
"start": "next start",
"lint:next": "next lint",
"lint": "eslint './**/*.{js,jsx,ts,tsx}' --quiet",
"lint:fix": "eslint './**/*.{js,jsx,ts,tsx}' --fix --quiet",
"slicemachine": "start-slicemachine",
"format": "prettier --write .",
"test": "jest",
"analyze": "ANALYZE=true next build",
"tailwind-config-viewer": "tailwind-config-viewer -o",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"chromatic": "npx chromatic --project-token=chpt_1f9dca6e3c11f4e",
"compile": "tsc"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.86.0",
"@aws-sdk/s3-request-presigner": "^3.86.0",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-brands-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"@fortawesome/react-fontawesome": "^0.1.18",
"@knocklabs/react-notification-feed": "^0.8.4",
"@metamask/onboarding": "^1.0.1",
"@milkdown/core": "^6.4.1",
"@milkdown/plugin-emoji": "^6.4.1",
"@milkdown/plugin-listener": "^6.4.1",
"@milkdown/plugin-menu": "^6.4.1",
"@milkdown/plugin-tooltip": "^6.4.1",
"@milkdown/preset-gfm": "^6.4.1",
"@milkdown/prose": "^6.4.1",
"@milkdown/react": "^6.4.1",
"@milkdown/theme-tokyo": "^6.4.1",
"@next/bundle-analyzer": "^13.4.2",
"@popperjs/core": "^2.11.6",
"@prismicio/client": "^7.0.1",
"@prismicio/next": "^1.2.1",
"@prismicio/react": "^2.6.2",
"@prismicio/types": "^0.2.8",
"@privy-io/react-auth": "^1.25.1",
"@radix-ui/react-visually-hidden": "1.0.2",
"@snapshot-labs/snapshot.js": "^0.4.18",
"@web3-react/core": "^8.2.0",
"axios": "^0.27.2",
"body-scroll-lock": "^4.0.0-beta.0",
"classnames": "^2.3.2",
"cookie": "^0.5.0",
"date-fns": "^2.29.2",
"debounce": "^1.2.1",
"ethers": "^5.6.5",
"image-trace-loader": "^1.0.2",