keystonejs / keystonejs/keystone
Local assets example throws an error on image upload
- Dominant language
- TypeScript
- Stars
- 10k
- Forks
- 1.3k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 19
Description
When running the `examples/assets-local` with `pnpm dev` and try to upload an image I get:
```txt
An error occurred while resolving input fields.
- Post.banner: require() of ES Module /home/jneidel/tmp/keystone/node_modules/.pnpm/file-type@19.0.0/node_modules/file-type/index.js from /home/jneidel/tmp/keystone/packages/core/src/lib/assets/createImagesContext.ts not supported.
Instead change the require of index.js in /home/jneidel/tmp/keystone/packages/core/src/lib/assets/createImagesContext.ts to a dynamic import() which is available in all CommonJS modules.
```

`node -v => v16.20.2`
Contributor guide
Research direction
Reproduce the failure in examples/assets-local with pnpm dev and an image upload, then inspect packages/core/src/lib/assets/createImagesContext.ts where the error originates. Confirm the fix by running the example on Node v16.20.2 and verifying that image uploads complete without the module-resolution error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100