Invalid warning on Windows: reported dependencies need to be absolute paths.
See original GitHub issueBug report
What is the current behavior? When importing “electron” on windows, the following warning is displayed:
Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths.
However, the paths listed are already absolute.
This appears to be the same issue resolved here: https://githubmemory.com/repo/sysgears/mochapack/issues/99
If the current behavior is a bug, please provide the steps to reproduce.
For a minimal repro, copy the ABSOLUTE_PATH_REGEX: https://github.com/webpack/webpack/blob/d77d8636015ae71195b16b39dd0e6daebdcace83/lib/NormalModule.js#L87 into regex101 and test the following absolute path: C:/src/TheCoin/apps/admin/node_modules/electron/dist/chrome_100_percent.pak. The regex will fail to match
I have traced the issue to the line import { ipcRenderer } from 'electron';
What is the expected behavior?
No errors. The paths are absolute and things are (to the best of my knowledge) working correctly
I didn’t look any further because the regex kinda doesn’t make sense the way it’s setup. The () brackets don’t separate the characters, so the |
or statements don’t switch on the path separator. I’m not actually sure what’s it is testing, but it clearly seems to want to test ^[a-zA-Z]:(\\|\\\\|\/)
(note the different opening (
If there are valid reasons to leave the regex as-is, then I’ll try and figure out why this issue is happening the way it is. There may be alternative ways to resolve this.
Other relevant information: webpack version: 5.39.0. I can’t test latest (I’m locked to electron-forge’s version) but the regex has not changed, so I assume the issue still exists. Node.js version: 14 Operating System: Win10 Additional tools: Electron
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
It is limitation, otherwise it is not possible to distinguish which path is absolute and which is not, please fix it in a plugin/loader
Came across to this problem on windows too.