Create client according to docs (replacing repositoryName and accessToken):
import * as prismic from '@prismicio/client'
// Fill in your repository name
export const repositoryName = 'your-repo-name'
const endpoint = prismic.getEndpoint(repositoryName)
export const client = prismic.createClient(endpoint, {
// If your repo is private, add an access token
accessToken: '',
// This defines how you will structure URL paths in your project.
// Update the types to match the Custom Types in your project, and edit
// the paths to match the routing in your project.
//
// If you are not using a router in your project, you can change this
// to an empty array or remove the option entirely.
routes: [
{
type: 'page',
path: '/:uid',
},
],
})
Registering Client:
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import { PrismicProvider } from '@prismicio/react'
import { client } from './prismic'
ReactDOM.render(
<React.StrictMode>
<PrismicProvider client={client}>
<App />
</PrismicProvider>
</React.StrictMode>,
document.getElementById('root')
)
While trying to resolve module `imgix-url-builder` from file `/Path/to/project/node_modules/@prismicio/helpers/dist/index.js`, the package `/Path/to/project/node_modules/imgix-url-builder/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Path/to/project/node_modules/imgix-url-builder/dist/index.cjs`. Indeed, none of these files exist:
* /Path/to/project/node_modules/imgix-url-builder/dist/index.cjs(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
* /Path/to/project/node_modules/imgix-url-builder/dist/index.cjs/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
Versions
Reproduction
Additional Details
Steps to reproduce
npm install @prismicio/react @prismicio/client @prismicio/helpers
Create client according to docs (replacing repositoryName and accessToken):
Registering Client:
Perfomr Query:
What is expected?
To show the document
What is actually happening?
Getting this error while bundling: