Steven

Results 553 comments of Steven

Thanks for the repro steps! This code is quite dynamic since the protobuf file path is never passed directly to a fs.readFile(), and instead is passed to `loadSync()` https://github.com/protobufjs/protobuf.js/blob/95b56817ef6fb9bdcb14d956c159da49d0889bff/src/root.js#L244 https://github.com/protobufjs/protobuf.js/blob/95b56817ef6fb9bdcb14d956c159da49d0889bff/src/root.js#L85...

Could be an asset read like `fs.readFile('./foo.js')` Also could be from `--asset-builds` flag.

Does it work when running your source file with `node` directly? Typically you need either `{ "type": "module" }` in package.json or rename the file to `.mjs` https://nodejs.org/api/esm.html#enabling

This sounds like a duplicate of https://github.com/vercel/ncc/issues/749

Sounds good. How about a new flag like “--external-dependencies” to opt in?

I was able to reproduce with a `index.mjs` containing `import fs from 'node:fs'; console.log(typeof fs);` which outputs: ``` import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module"; /******/ "use strict"; /******/...

Looks like webpack always emits CJS for `node:` for some reason https://github.com/webpack/webpack/pull/12693 Looks like it needs Node.js 16 or newer.