JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q9045F
  • License MIT

auto fix ERR_REQUIRE_ESM by esbuild

Package Exports

  • @gongt/fix-esm
  • @gongt/fix-esm/package.json

Readme

fix-esm

fix ERR_REQUIRE_ESM with realtime esbuild transform.

require('@gongt/fix-esm') will register legacy commonjs loader, mutiple call will ignored. (no way to unregister)

When ERR_REQUIRE_ESM happen, it will spawn esbuild to compile target file. loaded module will inside require cache. compiled result will save at filename.jsc to speed up next run.

It's best to use this package in a final-end-user project, not in a library, many people have thier own fix-esm method, may cause conflict.