Closed vishwa795 closed 3 months ago
Hi @vishwa795,
The error suggests you are trying to import something from @keystone-6/fields-document/dist/declarations/src/component-blocks
but that is not defined in the exports of the package, what are you importing from that location?
Ah, my bad the import was hapenning from wrong location.
I guess vscode automatically imported from the wrong location. However, Im getting a diferrent error now.
This is how i'm using the component blocks ^^
Getting the following error:
Module not found: Can't resolve '/Users/vishwa/Desktop/work/curio/apps/component-blocks.tsx'
8 | import * as view5 from "@keystone-6/core/fields/types/timestamp/views";
9 | import * as view6 from "@keystone-6/fields-document/views";
> 10 | import * as view7 from "/Users/vishwa/Desktop/work/curio/apps/component-blocks.tsx";
11 |
12 | var adminConfig = {};
13 |
Your views: path.resolve("../component-blocks.tsx")
on line 32 is being converted to /Users/vishwa/Desktop/work/curio/apps/component-blocks.tsx
which can't be found, so your path of ../component-blocks.tsx
is not correct.
ui: {
views: path.resolve(__dirname, "..", "src/component-blocks.tsx"),
}
I got it working with the above snippet. But when i try to use
ui: {
views: "../component-blocks.tsx",
}
It fails with the Module not found error. In the screen shot attached above you can see that I'm referencing my parent directory for component blocks. Ideally ../component-blocks.tsx
should have also worked.
EDIT: Maybe it's trying to look into .keystone folder:
ui: {
views: path.resolve(__dirname, "component-blocks.tsx"),
}
Location referenced for above output.
Use the keystone boilerplate repository. In the post schema, add a component block exactly as mentioned in the docs.
Application should run fine.
node version: 17.0.0 Latest keystone version