Closed raphaelschwinger closed 3 years ago
Hi, I understand that your PR fixes the string literal issue, but does it really solves the issue of not having some of those optional files?
Hey @simov, What do you mean with "having some of those optional files"? Require should only be executed for a specific file if the same conditions as before apply.
How is parcel or esbuild bundling anything in case they are not trying to resolve all paths eagerly by static analysis? That's how webpack works, it tries to bundle all paths found regardless of logical code structure. So what happens is that webpack throws errors https://github.com/simov/grant/issues/212 for the files that are missing.
As far as I understand it esbuild is only bundling stuff it can find by static analysis. Thats why all of those require
statements in grant.js
get not executed and then it fails at runtime.
I did a few tests on my own, fixed in #232
@simov thank you :)
Thanks @simov and others for your great work!
Summary
Importing from paths generated at runtime breaks parcel, see (parcel-bundler/parcel#4031), or esbuild, see (evanw/esbuild#480). Building fails or throws a warning like this:
This can lead to problems at runtime.