watchpack icon indicating copy to clipboard operation
watchpack copied to clipboard

fix: ignore the error that directoryPath is not a directory

Open liximomo opened this issue 3 years ago • 2 comments

The error is caused by a specific alias config of webpack, considering the following example:

// webpack.config.js
module.exports = {
  resolve: {
    alias:  {
       "@/foo": ["src/foo/index", "src/foo"] 
     }
  }
}

With the above config, we will get a DirectoryWatcher watching src/foo/index. If you happen to have a src/foo file on your filesystem, you will see the error:

Watchpack Error (initial scan): Error: ENOTDIR: not a directory, scandir '/Users/xx/demo/src/foo'

We could safely ignore the error of ENOTDIR in whatever cases.

Related Issues: https://github.com/nuxt/bridge/issues/226

liximomo avatar Dec 12 '22 14:12 liximomo

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: liximomo / name: X.L (fe84a8b5b4a5b2b22e01d68d27f823c5961f7392)

Codecov Report

Base: 92.12% // Head: 78.11% // Decreases project coverage by -14.00% :warning:

Coverage data is based on head (9ccfcf3) compared to base (dc690bb). Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #226       +/-   ##
===========================================
- Coverage   92.12%   78.11%   -14.01%     
===========================================
  Files           6        6               
  Lines        1041     1042        +1     
  Branches      249      250        +1     
===========================================
- Hits          959      814      -145     
- Misses         82      228      +146     
Flag Coverage Δ
integration 78.11% <0.00%> (-14.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/DirectoryWatcher.js 91.06% <0.00%> (-1.51%) :arrow_down:
lib/reducePlan.js 2.98% <0.00%> (-92.54%) :arrow_down:
lib/watchEventSource.js 47.69% <0.00%> (-38.47%) :arrow_down:
lib/watchpack.js 92.14% <0.00%> (-0.83%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Dec 12 '22 22:12 codecov[bot]