protobuf.js icon indicating copy to clipboard operation
protobuf.js copied to clipboard

import "protobufjs/minimal" doesn't work

Open dynst opened this issue 5 months ago • 0 comments

https://github.com/protobufjs/protobuf.js/blob/f42297b29d15c8e0382744a83f5147a1aa978f42/cli/targets/static-module.js#L21

pbjs -w es6 will generate an import statement that simply fails, because it's ES6 not CommonJS.

It can't import a file with the extension omitted, it has to import "protobufjs/minimal.js".

Or an "exports" field entry for /minimal needs to be added to protobufjs to make it work.

https://nodejs.org/api/esm.html#import-specifiers

dynst avatar Jul 11 '25 18:07 dynst