Hacker News new | ask | show | jobs
by snek 2225 days ago
there are no "async" or "sync" imports in js. there are static and dynamic imports. An implementation is free to spend as much time as it likes between parsing a file to get the static imports and actually running the file doing whatever it likes, including fetching urls, reading the file system, etc. dynamic imports return a promise but the implementation is free to resolve that promise immediately (e.g. `return Promise.resolve(loadSync(module))`)
1 comments

I suppose that makes sense since loading a module from a file on a disk isn't all that different from loading a file over a TCP connection.