keystonejs-contrib / k6-contrib

Keyston-6 contrib
MIT License
35 stars 18 forks source link

fields-azure: Module not found: Can't resolve '@k6-contrib/fields-azure/file' #37

Closed sfodor closed 2 years ago

sfodor commented 2 years ago

Hi,

After creating a new keystonejs app with 'yarn create keystone-app', adding the fields-azure package with 'yarn add @k6-contrib/fields-azure', and adding a 'file: azureStorageFile({ azureStorageConfig: config }),' line to the User in schema.ts I get the following error when the 'yarn dev' is run:

PS C:\tmp\myapp\azure> yarn dev
yarn run v1.22.19
$ keystone dev
✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:3000
⭐️ GraphQL API Starting on http://localhost:3000/api/graphql
✨ Generating GraphQL and Prisma schemas
✨ The database is already in sync with the Prisma schema.
✨ Connecting to the database
✨ Creating server
✅ GraphQL API ready
✨ Generating Admin UI code
✨ Preparing Admin UI app
error - ./pages/_app.js:5:0
Module not found: Can't resolve '@k6-contrib/fields-azure/file'
  3 | import * as view0 from "@keystone-6/core/___internal-do-not-use-will-break-in-patch/admin-ui/id-field-view";
  4 | import * as view1 from "@keystone-6/core/fields/types/text/views";
> 5 | import * as view2 from "@k6-contrib/fields-azure/file";
  6 | import * as view3 from "@keystone-6/core/fields/types/password/views";
  7 | import * as view4 from "@keystone-6/core/fields/types/relationship/views";
  8 | import * as view5 from "@keystone-6/core/fields/types/timestamp/views";

https://nextjs.org/docs/messages/module-not-found
✅ Admin UI ready
sfodor commented 2 years ago

The following patch solved the problem for me:

@@ -393,7 +393,7 @@ const azureStorageImage = _ref => {

       }),
       unreferencedConcreteInterfaceImplementations: [AzureStorageImageFieldOutputType],
-      views: '@k6-contrib/fields-azure/image'
+      views: '@k6-contrib/fields-azure/views/image'
     }));
   };
 };
@@ -546,7 +546,7 @@ const azureStorageFile = _ref => {

       }),
       unreferencedConcreteInterfaceImplementations: [AzureStorageFileFieldOutputType],
-      views: '@k6-contrib/fields-azure/file'
+      views: '@k6-contrib/fields-azure/views/file'
     }));
   };
 };
gautamsi commented 2 years ago

I have published version 3.0.1 with this fix, let me know if that works for you.

sfodor commented 2 years ago

Thank you. Now it works for me.

One note to the packages/fields-azure/README.md file, I think the config should be renamed to azureStorageConfig to have it working, also the line import 'dotenv/config' may not needed.