Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mildrenben opened this issue May 30, 2024 · 1 comment
Open

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

mildrenben opened this issue May 30, 2024 · 1 comment

Comments

@mildrenben
Copy link

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.

@mildrenben mildrenben changed the title Build fails in Docker when importing Zod Build fails in Docker when importing certain Modules (like Zod) May 30, 2024
@JasonColeyNZ
Copy link

I am using zod inside a docker image (for fly.io) and don't have any issues. I have zod in my vite.config.ts optimizeDeps -> include array, along with other libraries. I am using node 20 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants