You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
Is it possible to do something like this with esm to synchronously import esm modules?
importesmfrom'esm'import{createRequire}from"node:module";constrequire=createRequire(import.meta.url)(esm)(module);// synchronously import a fileconstthing=require('./somefile.js')
The text was updated successfully, but these errors were encountered:
I found a work around by creating a .cjs file to handle the dynamic imports. Alas it struggles to import ESM files if the imported file doesn't have a .mjs extension. Setting package.json type to module in the package of the imported file seems to make no difference.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is it possible to do something like this with
esm
to synchronously import esm modules?The text was updated successfully, but these errors were encountered: