Can't resolve standard node library if require includes '/' (slash)
See original GitHub issueBug report
What is the current behavior?
doesnt_work.js:
require('util/types');
The command below:
node_modules/.bin/webpack --target=node --entry ./doesnt_work.js
throws Module not found: Error: Can't resolve 'util/types' in '/Users/pbadenski/workspace/test'
Note: It works fine if require doesn’t contain slash ie. require('util').types
If the current behavior is a bug, please provide the steps to reproduce.
doesnt_work.js:
require('util/types');
node_modules/.bin/webpack --target=node --entry ./doesnt_work.js
What is the expected behavior?
Running webpack doesnt_work.js
should resolve util/types
successfully as NodeJS documentation says API is accessible via require('util').types or require('util/types').
(https://nodejs.org/api/util.html#utiltypes)
Other relevant information:
webpack version: 5.68.0
Node.js version: v17.1.0
Operating System: MacOS 11.6.2 (20G314)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
@sibelius currently in master. next release will be on this week probably…
is this fixed in which wepback version?