Skip to content

pnpm deploy strips imports key from package.json, breaking ESM projects #9193

@ThisIsMissEm

Description

@ThisIsMissEm

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

v10.5.2

Which area(s) of pnpm are affected? (leave empty if unsure)

CLI

Link to the code that reproduces this issue or a replay of the bug

https://github.com/FediMod/fires/tree/feat/setup-docker-file

Reproduction steps

  1. After cloning the branch given above, change line 100 of Dockerfile to just cp /fires-server-deploy/package.json /fires-server-build/package.json
  2. run docker build . --target fires-server --tag fires-server:latest
  3. run the interactive container:
docker run -it --rm --env-file=components/fires-server/.env.docker fires-server /bin/sh
  1. cat package.json, observe that it's missing the imports key (this exists in the source package.json)

This can also be verified by trying to run in the container node ace list which crashes as it can't find #start/env

(Apologies for the kinda messy steps, this was the only good reproduction steps I could offer, but you could probably verify it with any package that has imports key set in it's package.json)

Describe the Bug

The imports key is important for ESM based apps, allowing for remapping imports from, e.g., #start/env to ./start/env.js

Without this key in the package.json, Adonis.js applications fail to start.

Expected Behavior

The package.json should be verbatim as it exists in the source of the pnpm deploy package to deploy, only with the packageManager, and dependency related keys replaced (this would give most compatibility with existing software)

Which Node.js version are you using?

22.x

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

alpine (Linux 47bc21689fff 6.12.5-linuxkit aarch64 Linux)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions