Closed Jamesernator closed 5 years ago
Hi @Jamesernator!
Wrapping functions is something I could do but I want to avoid until there’s more demand. Until then esm
may not be the best thing for your situation.
Update:
Since puppeteer
is a popular utility, I'll investigate esm
shimming puppeteer
to scrub its strings.
Update:
Patch https://github.com/standard-things/esm/commit/c23140473ccedf6bd6b73be53677d0b02bd2552d; https://github.com/standard-things/esm/commit/38a6b7d7f776211c6353f588504544ae99fc5ce5
Update:
esm
v3.2.21 is released :tada:
Awesome thanks for this.
Because esm transforms
import()
in all source locations this can break the use ofimport()
that occurs with a puppeteer function. This has made it impossible to test my library withava
as it depends on being able to useimport()
insidepage.evaluate
.A simple minimal example that breaks:
With
--experimental-modules
this works fine but with-r esm
it fails withError: Evaluation failed: ReferenceError: _c72 is not defined
.Probably the best way to fix it would be to patch functions
.toString
method so that it returns the original source text rather than the transformed source text.