You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run npx webpack build --target node --entry ./lib/main.js. It produces this error:
assets by status 123 bytes [cached] 1 asset
./lib/main.js 14 bytes [built] [code generated]
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
ERROR in ./lib/main.js 1:0-13
Module not found: Error: Can't resolve '#fs' in '/tmp/test/lib'
resolve '#fs' in '/tmp/test/lib'
using description file: /tmp/test/package.json (relative path: ./lib)
resolve as internal import
using imports field: fs
Parsed request is a module
using description file: /tmp/test/package.json (relative path: ./lib)
resolve as module
/tmp/test/lib/node_modules doesn't exist or is not a directory
looking for modules in /tmp/test/node_modules
single file module
using description file: /tmp/test/package.json (relative path: ./node_modules/fs)
no extension
/tmp/test/node_modules/fs doesn't exist
.js
/tmp/test/node_modules/fs.js doesn't exist
.json
/tmp/test/node_modules/fs.json doesn't exist
.wasm
/tmp/test/node_modules/fs.wasm doesn't exist
/tmp/test/node_modules/fs doesn't exist
/tmp/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
webpack 5.54.0 compiled with 1 error and 1 warning in 168 ms
The text was updated successfully, but these errors were encountered:
Does it? For non-subpath imports, Webpack already knows to avoid trying to bundle require('fs'). I'd assume that it could just re-use the same logic here.
Support for subpath imports was added in #293, but they're broken if one of the subpaths is a built-in Node.js module. To reproduce:
package.json
:lib/main.js
:Run
npx webpack build --target node --entry ./lib/main.js
. It produces this error:The text was updated successfully, but these errors were encountered: