Skip to content

FileSystemInfo can not createSnapshot with symbol link #12246

Description

@killagu

Bug report

What is the current behavior?
I install deps with npminstall(it can install faster), but the file tree in node_modules is special bacause npminstall install pkgs with symbol link to download and write less files.

The file tree looks like this

app
├── index.js
└── node_modules
    ├── _a@1.0@a(real dir)
    |   ├── index.js
    |   └── node_modules
    |       └── b(symbol link to app/node_modules/_b@1.0@b)
    ├── _b@1.0@b(real dir)
    |   ├── index.js
    |   └── node_modules
    |       └── a(symbol link to app/node_modules/_a@1.0@a)
    ├── a(symbol link to app/node_modules/_a@1.0@a)
    └── b(symbol link to app/node_modules/_b@1.0@b)

Because of a,b is reference by each other, contextTimestampQueue and contextHashQueue in FileSystemInfo will never reach the end.

If the current behavior is a bug, please provide the steps to reproduce.

The minimal reproduction repo is here.
The reproduce step is

git clone git@github.com:killagu/npminstall_webpack.git
cd npminstall_webpack
npm i -g cnpm
# must use cnpm install
cnpm i
npm run build

Build snapshow will fail.

What is the expected behavior?

  • Use fs.lstat to get file info, and use target path to process.
  • Skip files if has been processed

Other relevant information:

webpack version: 5.11.0
Node.js version: 12.16.3
Operating System: macOS Big Sur 11.0.1 (20B29)

If it is ok, I'm happy to make a pr to fix it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions