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

[Bug]: Module not found: Can't resolve <entry_path> in Docker #8433

Open
mxmason opened this issue Nov 14, 2024 · 9 comments
Open

[Bug]: Module not found: Can't resolve <entry_path> in Docker #8433

mxmason opened this issue Nov 14, 2024 · 9 comments
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.

Comments

@mxmason
Copy link

mxmason commented Nov 14, 2024

System Info

System:
OS: macOS 15.1
CPU: (8) arm64 Apple M1 Pro
Memory: 262.28 MB / 32.00 GB
Shell: 5.9 - /opt/homebrew/opt/zsh/bin/zsh
Binaries:
Node: 20.11.0 - ~/.local/state/fnm_multishells/44569_1731538780778/bin/node
npm: 10.2.4 - ~/.local/state/fnm_multishells/44569_1731538780778/bin/npm
Browsers:
Chrome: 130.0.6723.117
Safari: 18.1
npmPackages:
@rspack/cli: 1.1.1 => 1.1.1
@rspack/core: 1.1.1 => 1.1.1

Details

As of v1.1.1, rspack does not successfully build in Docker containers. This bug is not present in rspack v1.1.0, or when installing directly on the host machine.

Reproduce link

https://github.com/mxmason/rspack-repro-docker

Reproduce Steps

  1. Clone the example repo
  2. Start a docker daemon
  3. docker build . -f Dockerfile-rspack -t rspack-image
  4. Observe the error below
ERROR in × Module not found: Can't resolve './src/index' in '/app'
help: Found module './src/index.js'. However, it's not possible to request this module without the extension
      if its extension was not listed in the `resolve.extensions`. Here're some possible solutions:

      1. add the extension `".js"` to `resolve.extensions` in your rspack configuration
      2. use './src/index.js' instead of './src/index'

ERROR in ×   Error: Child compilation failed:
│     × Module not found: Can't resolve '/app/node_modules/html-webpack-plugin/def  ault_index.ejs' in '/app'
│
│   - child-compiler.js:211
│     [app]/[html-webpack-plugin]/lib/child-compiler.js:211:18
│
│   - index.js:13364 finalCallback
│     [app]/[@rspack]/core/dist/index.js:13364:9
│
│   - index.js:13386
│     [app]/[@rspack]/core/dist/index.js:13386:14
│
│   - index.js:13488
│     [app]/[@rspack]/core/dist/index.js:13488:18
│
│   - index.js:473 done
│     [app]/[@rspack]/lite-tapable/dist/index.js:473:13
│
│   - index.js:480 AsyncSeriesHook.callAsyncStageRange
│     [app]/[@rspack]/lite-tapable/dist/index.js:480:20
│
│   - index.js:82 AsyncSeriesHook.callAsync
│     [app]/[@rspack]/lite-tapable/dist/index.js:82:21
│
│   - index.js:13484
│     [app]/[@rspack]/core/dist/index.js:13484:33
│
│   - index.js:13528
│     [app]/[@rspack]/core/dist/index.js:13528:37

Compare to building directly on the host machine, which works fine:

npm ci
npm run build:rspack

Builds in Docker also work in v1.1.0. To demonstrate, downgrade the rspack binaries and try to build the Docker image again:

npm i -DE @rspack/cli@1.1.0 @rspack/core@1.1.0
docker build . -f Dockerfile-rspack -t rspack-image
@mxmason mxmason added bug Something isn't working pending triage The issue/PR is currently untouched. labels Nov 14, 2024
@Robot-Inventor
Copy link

The same issue is occurring on Cloudflare Pages. Although I haven’t changed the code, after updating rspack from v1.1.0 to v1.1.1, a "module not found" error started appearing. Building locally works without any issues.

@zMcKracken
Copy link

zMcKracken commented Nov 14, 2024

We have a similar issue with @rsbuild/core: 1.1.1 also, probably related? Rolling back to @rsbuild/core: 1.0.19 that uses @rspack/core: 1.0.14 fixes the issue

@Yee1014
Copy link

Yee1014 commented Nov 15, 2024

I also have the same problem.
我也有同样的问题。
🤣

@Gijsdeman
Copy link

Gijsdeman commented Nov 15, 2024

Running into a similar problem with Docusaurus. However, Docusaurus is only dependent on @rspack/core@1.0.14. Instead, I have to explicitly resolve @rspack/binding@1.0.14.

We have a similar issue with @rsbuild/core: 1.1.1 also, probably related? Rolling back to @rsbuild/core: 1.0.19 that uses @rspack/core: 1.0.14 fixes the issue

@rsbuild/core depends on @rspack/core, which in turn depends on @rspack/binding@1.0.14. Since this seems to be the only package I have issues with, I assume this internal package (or more likely, one of its optional dependencies) is causing these issues.

@mes113
Copy link

mes113 commented Nov 15, 2024

same for me Rolling back to @rsbuild/core: 1.0.19 solve issue

@Gijsdeman
Copy link

Gijsdeman commented Nov 15, 2024

Works for linux-x64-gnu, but fails for linux-x64-musl. That is, using an node:18-alpine image which uses musl fails, but if I use node:18-bullseye which uses gnu, it works fine.

If I may believe my yarn.lock, these are the possible different bindings:

  optionalDependencies:
    "@rspack/binding-darwin-arm64" "1.1.1"
    "@rspack/binding-darwin-x64" "1.1.1"
    "@rspack/binding-linux-arm64-gnu" "1.1.1"
    "@rspack/binding-linux-arm64-musl" "1.1.1"
    "@rspack/binding-linux-x64-gnu" "1.1.1"
    "@rspack/binding-linux-x64-musl" "1.1.1"
    "@rspack/binding-win32-arm64-msvc" "1.1.1"
    "@rspack/binding-win32-ia32-msvc" "1.1.1"
    "@rspack/binding-win32-x64-msvc" "1.1.1"

@mes113
Copy link

mes113 commented Nov 15, 2024

we are using node:20.11.1-alpine3.18 and its failing

@chenjiahan
Copy link
Member

Pin @rspack/core to 1.1.0 should fix this.

For example, use pnpm overrides:

// package.json
{
  "pnpm": {
    "overrides": {
      "@rspack/core": "1.1.0"
    }
  }
}

@mateuszwrobel
Copy link

for us it's a problem with "tsconfig.json". Rspack do not see this file at all in docker with node:20.5.0-alpine to node:23.1.0-alpine. changing location of a file in docker container does not resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

8 participants