Closed Vampire closed 3 weeks ago
This is expected. Usually eval is used to intentionally avoid static analysis tools like ncc.
Not in this case I think.
Here it is more to due to the polyfill hack it is I think.
If I preprocess the compile result by replacing eval('require')(
by require(
before sending it through ncc, that allows it to pack properly and it seems to work so far. :-)
Would there be another work-around possible like telling ncc to bring over those modules or something like that?
No other workarounds at this time. If you fix the code to use require(), it should work as expected.
I have a Kotlin/JS project that uses ncc on the compile result to pack the result together for usage as GitHub Action. Now I added ktor client as a dependency. This has three
eval('require')('some-module')
calls in the JavaScript. (Don't ask me why, I don't know, this also makes it incompatible to ESM. But the end-result is, that if you try to run thencc
-packed code, you get missing modules errors for those when the code is hit.