I'm setting up Prismic in SvelteKit - I am attempting to use prismic-ts-codegen - I have followed the docs and get as far as running npx prismic-ts-codegen init but run into the following error:
file:///***/node_modules/prismic-ts-codegen/dist/cli/loadLocaleIDs.js:2
import { createClient } from './../_node_modules/@prismicio/client/dist/createClient.js';
^^^^^^^^^^^^
SyntaxError: Named export 'createClient' not found. The requested module './../_node_modules/@prismicio/client/dist/createClient.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from './../_node_modules/@prismicio/client/dist/createClient.js';
const { createClient } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
Node.js v18.16.1
I've checked my node version etc but can't seem to move past this error.
Thank you for your experience return. It's not working for as when we downgrade to "prismic-ts-codegen": "0.1.11". Hope, there is a solution for it soon.
This is my error :
import { createClient } from './../_node_modules/@prismicio/client/dist/createClient.js';
^^^^^^^^^^^^
SyntaxError: Named export 'createClient' not found. The requested module './../_node_modules/@prismicio/client/dist/createClient.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from './../_node_modules/@prismicio/client/dist/createClient.js';
const { createClient } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
yeah I can reproduce this error with version 0.1.15, but not with 0.1.11. maybe remove your node_modules directory to be sure you use the right version ?