Skip to content

Build fails in Docker when importing certain Modules (like Zod) #9526

Open
@mildrenben

Description

@mildrenben

Reproduction

https://github.com/mildrenben/zod-remix-issue

System Info

System:
    OS: macOS 14.3.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 57.81 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.7.0 - ~/.nvm/versions/node/v18.7.0/bin/node
    npm: 8.15.0 - ~/.nvm/versions/node/v18.7.0/bin/npm
    pnpm: 7.9.3 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 125.0.6422.113
    Safari: 17.3.1
  npmPackages:
    @remix-run/css-bundle: ^2.9.2 => 2.9.2 
    @remix-run/dev: ^2.9.2 => 2.9.2 
    @remix-run/express: ^2.9.2 => 2.9.2 
    @remix-run/node: ^2.9.2 => 2.9.2 
    @remix-run/react: ^2.9.2 => 2.9.2 
    vite: ^5.2.11 => 5.2.12

Used Package Manager

npm

Expected Behavior

Running the build from within Docker works.

Actual Behavior

Running the build from withing Docker fails.

I generated the boilerplate with remix blues stack.

If I add certain modules and import them, I get this error when building but ONLY inside Docker. ERROR: No matching export in "zod/index.ts" for import "z". Zod is an easy example I've shown in the above repo.

Of course, zod does exist in node_modules within the docker image.

I can run npm run build locally and it will work just fine, but inside Docker it fails.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions