Skip to content

loader: fix importing cjs with url parts such as query

Module.prototype.load doesn't have query/fragment/etc so it is unable to properly reach back into the loader cache and importing any cjs modules with these parts of a url resulted in getting a namespace with default being undefined. also the cjs loader sometimes would completely overwrite entries in the module map which like breaks all sorts of things so that's fixed too.

props to @bdistin for trying out esm with his codebase and finding this, i wish more people would :(

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

p.s. import 'fs?q=1' is broken but i don't know a good way to fix it (my current thought is specifier.split(/[?#]/)[0] but that seems nasty)

Merge request reports

Loading