Skip to content

esm: merge and simplify loader hooks

Rodrigo Muino Tomonari requested to merge github/fork/jkrems/simplify-hooks into master

Demo for reducing the number of hooks and allowing more delegation to the builtin hooks.

Downsides:

  • Eagerly loads source for JSON, even when it's not used.
  • If node thinks a module is CommonJS, it will currently not return the source from getSource. Since we now parse the CommonJS source for named exports, it would likely be fine if we'd return source from load anyhow but it's unclear how that would interact with userland hooks.
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading