4 ms·
>For use on the web the web server could grep require from the source and push modules to the browser Nope. The server can’t figure out which modules are neede
by tzahola 9y ago
>For use on the web the web server could grep require from the source and push modules to the browser
Nope. The server can’t figure out which modules are needed unless it runs the program:
if (isPrime(366226717)) {
require(“hugeModule”)
}
- z3t4 9y agoNo need to make sense of the code, just run a regex to find all require's. Could also use a package.json
- kofejnik 9y agocan you regex this: var _0xdde4=["\x6C\x65\x66\x74\x70\x61\x64"];require(_0xdde4[0])
- z3t4 9y agoworst case scenario is that the browser has to request it from the server. This is bad because the execution would have to stop and wait, but for most cases it would just be for a few milliseconds. And the developer should take that into account and maybe prep the cache for possible paths.
- tzahola 9y agorequire(calculateTenthMersennePrime().toString() + “.js”)
- deleted 9y ago[deleted]