Skip to content

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

@mxmason

Description

@mxmason

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpending triageThe issue/PR is currently untouched.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions