| ▲ | WorldMaker 3 hours ago | |||||||
A lot of this seems to be a reminder that the CommonJS module format should just be left to die already. Not that you can't pull similar tricks with `await import()` in ESM, but you can't easily grep an entire dependency for dynamic `require()` half as easily as you can can `grep import\s*\(` for dynamic import and analysis tools for static `import` keyword are easy to use/build rather than no such thing for CommonJS. Someone thought I was joking when I said I always check JSR before NPM now, because I trust ESM so much more than CommonJS. | ||||||||
| ▲ | bastawhiz 2 hours ago | parent [-] | |||||||
This is only partially true: dynamic imports are syntax (like super) but that's not a huge deterrent to hiding them. You could easily do `i = x => import(x)` to obfuscate the imports. Suddenly something looking like `await globalThis[computedValueEqualToI]` is doing imports. You still know stuff is being imported, you just have no idea what without a hell of a lot of effort, which is almost exactly the same effort as with require(). | ||||||||
| ||||||||