Closed shellscape closed 1 year ago
Depends on enviroment (node, bun, deno, some bundler) and module system you are using commonjs vs ES modules
If there is no default property then DefaultImport is probably a function itself and you just call that.
That's a pretty lazy take on a README, especially if you leave it up to the user to derive that nuance on their own.
Could the README try explain that nuance? Maybe, but it is a pretty common one and not unique to this repo at all.
I would expect most users to notice, as you did, the default property doesn't exist so they must have to just call DynamicImport
directly as code example is actually doing.
CommonJS vs ESM incompatibilities are definitely one of the bigger pains to try deal with ATM until everyone transitions to ESM as that seems to be the direction.
Actually did just notice that this repo is still telling typescript to compile down to CommonJS... would have to double check, but compiling straight to ESM may alleviate the need for that comment.
If we did that kind of thing in the docs with Rollup at 7mil downloads a week, we'd have users with pitchforks at our doors. Be a good steward, don't burden users.
Swapped to tsup and providing CJS and ESM builds with export mapping with fallback to main CJS build in 1.0.1.
I believe that fixes the need for that comment.
Hey there, thanks for the plugin. Looks like your docs might be incorrect:
DynamicImport
doesn't have adefault
property.