In our codebase, there’re a few cases where we deliberately use a native import() with a variable, like:
for (const moduleName of moduleNames) {
const evaluationResult = await import(/* webpackIgnore: true */ moduleName)
this.evaluatedModules[moduleName] = evaluationResult
}
This works in webpack thanks to /* webpackIgnore: true */ (docs). But in ESBuild, this produces a warning like:
xxx/xxx.ts:241:47: warning: This dynamic import will not be bundled because the argument is not a string literal
Is there any way to silence this warning for such import? If this was a string literal, I’d add it into externals, but I can’t do that with a variable.
In our codebase, there’re a few cases where we deliberately use a native
import()with a variable, like:This works in webpack thanks to
/* webpackIgnore: true */(docs). But in ESBuild, this produces a warning like:Is there any way to silence this warning for such import? If this was a string literal, I’d add it into
externals, but I can’t do that with a variable.