Impacted feature
when trying to import PrismicProvider
to the root.tsx
file in the Remix App
Errors
(node:10944) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
9:21:34 AM [vite] Error when evaluating SSR module /app/root.tsx: failed to import "@prismicio/react"
|- C:\Users\dhaval\Desktop\Coursera Learning\remix-prismic-poc\node_modules\@prismicio\react\dist\index.js:1
import { PrismicProvider } from "./PrismicProvider.js";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at cjsLoader (node:internal/modules/esm/translators:348:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:297:7)
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async nodeImport (file:///C:/Users/dhaval/Desktop/Coursera%20Learning/remix-prismic-poc/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52735:15)
9:21:34 AM [vite] Error when evaluating SSR module virtual:remix/server-build: failed to import "@prismicio/react"
|- C:\Users\dhaval\Desktop\Coursera Learning\remix-prismic-poc\node_modules\@prismicio\react\dist\index.js:1
import { PrismicProvider } from "./PrismicProvider.js";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at cjsLoader (node:internal/modules/esm/translators:348:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:297:7)
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async nodeImport (file:///C:/Users/dhaval/Desktop/Coursera%20Learning/remix-prismic-poc/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52735:15)
9:21:34 AM [vite] Internal server error: Cannot use import statement outside a module
at wrapSafe (node:internal/modules/cjs/loader:1281:20)
at Module._compile (node:internal/modules/cjs/loader:1321:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32)
at Module._load (node:internal/modules/cjs/loader:1024:12)
at cjsLoader (node:internal/modules/esm/translators:348:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:297:7)
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async nodeImport (file:///C:/Users/dhaval/Desktop/Coursera%20Learning/remix-prismic-poc/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:52735:15)
Your Role
Hosting provider
Currently trying to setup in my local & this is my PoC (Proof of Concept), once it's working then I'll setup it in my actual Remix Project where I need to integrate Prismic
Package.json file
"dependencies": {
"@prismicio/client": "^7.7.4",
"@prismicio/react": "^2.8.0",
"@remix-run/node": "^2.10.3",
"@remix-run/react": "^2.10.3",
"@remix-run/serve": "^2.10.3",
"isbot": "^4.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "^2.10.3",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"autoprefixer": "^10.4.19",
"eslint": "^8.38.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.4",
"typescript": "^5.1.6",
"vite": "^5.1.0",
"vite-tsconfig-paths": "^4.2.1"
},
"engines": {
"node": ">=20.0.0"
}