nitrojs / nitrojs/nitro

`lexical` node-specific package is not traced correctly

Open
#2,562 5 comments 18 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug nitro reproduction v2 workaround available
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Environment

Stackblitz

Reproduction
  1. Open the StackBlitz
  2. Run pnpm build
  3. Start the server
  4. See the error

To "fix"

  1. Uncomment the line in the nitro config which traces the package manually
  2. Rebuild and restart
Describe the bug

When using lexical, Nitro does not include the node-specific package (Lexical.node.mjs in the final artifact. This leads to the following error in prod: Cannot find module '/home/projects/github-br8xh5/.output/server/node_modules/lexical/Lexical.node.mjs' imported from /home/projects/github-br8xh5/.output/server/chunks/routes/index.mjs

Additional context

Originally reported in https://github.com/nuxt/nuxt/issues/27784

Logs

No response

Contributor guide

Open the contributing guide

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.

Research direction

Start with the linked StackBlitz reproduction, run pnpm build, and compare the output with and without the manual Nitro tracing configuration. Inspect how the build traces the lexical package; done means the artifact includes Lexical.node.mjs and the server starts without the production module error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.