Starting or Building Keystone with NODE_ENV set production fails.

Open
#8,774 18 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
node.js, typescript
Domain
build-system

Research direction

Start with the production build failure using the dotenv import in keysone.ts, comparing it with builds under development, testing, staging, and an undefined NODE_ENV. Reproduce with Node 16, 18, or 20 and verify that a newly scaffolded Keystone app builds successfully when NODE_ENV=production.

Written by the indexing model from the issue text.

Description

Please add steps to reproduce the problem

  • Scaffold a new Keystonejs app.
  • Install dotenv or a similar tool
  • inside keysone.ts file, import dotenv import 'dotenv/config';
  • set NODE_ENV=production in .env file
  • Try building the project.

Please describe what you expected to happen

It should build successfully. It builds in development, testing, and staging. It builds even when NODE_ENV is undefined. But only fails in production mode.

Please add any screenshots if possible

image

Please add contextual information such as your node version (node -v), or the web browser you used

Tried on NODE v16, v18, and v20 (using nvm).

Dominant language
TypeScript
Stars
10k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
38

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from keystonejs/keystone

All issues in keystonejs/keystone

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.