diff --git a/.changeset/views-do-change.md b/.changeset/views-do-change.md index a8df7db7989..8d32c45ce89 100644 --- a/.changeset/views-do-change.md +++ b/.changeset/views-do-change.md @@ -2,4 +2,4 @@ '@keystone-6/core': major --- -Changes field `.views` module resolution, from a path, to a module path that can be resolved at the project's root directory +Changes field `.views` module resolution, from a path, to a module path that is resolved from where `keystone start` is run diff --git a/docs/pages/docs/apis/fields.md b/docs/pages/docs/apis/fields.md index 1c9612606ae..a3aa3acb061 100644 --- a/docs/pages/docs/apis/fields.md +++ b/docs/pages/docs/apis/fields.md @@ -77,7 +77,7 @@ Options: See the [Hooks API](./hooks) for full details on the available hook options. - `label`: The label displayed for this field in the Admin UI. Defaults to a human readable version of the field name. - `ui`: Controls how the field is displayed in the Admin UI. - - `views`: A module specifier that will be resolved from the Keystone project's directory to a module containing code to replace or extend the default Admin UI components for this field. See the [Custom Field Views](../guides/custom-field-views) guide for details on how to use this option. + - `views`: A module path that is resolved from where `keystone start` is run, resolving to a module containing code to replace or extend the Admin UI components for this field. See the [Custom Field Views](../guides/custom-field-views) guide for details on how to use this option. - `createView.fieldMode` (default: `'edit'`): Controls the create view page of the Admin UI. Can be one of `['edit', 'hidden']`, or an async function with an argument `{ session, context }` that returns one of `['edit', 'hidden']`. Defaults to the list's `ui.createView.defaultFieldMode` config if defined. diff --git a/packages/core/src/admin-ui/system/createAdminMeta.ts b/packages/core/src/admin-ui/system/createAdminMeta.ts index 3e4155f85b0..ed5e4d7d1c7 100644 --- a/packages/core/src/admin-ui/system/createAdminMeta.ts +++ b/packages/core/src/admin-ui/system/createAdminMeta.ts @@ -171,13 +171,13 @@ export function createAdminMeta( function assertValidView(view: string, location: string) { if (view.includes('\\')) { throw new Error( - `${location} contains a backslash, which is invalid. You need to use a module path that can be resolved at the project's root directory (see https://github.com/keystonejs/keystone/pull/7805)` + `${location} contains a backslash, which is invalid. You need to use a module path that is resolved from where 'keystone start' is run (see https://github.com/keystonejs/keystone/pull/7805)` ); } if (path.isAbsolute(view)) { throw new Error( - `${location} is an absolute path, which is invalid. You need to use a module path that can be resolved at the project's root directory (see https://github.com/keystonejs/keystone/pull/7805)` + `${location} is an absolute path, which is invalid. You need to use a module path that is resolved from where 'keystone start' is run (see https://github.com/keystonejs/keystone/pull/7805)` ); } }