#need tsconfig incantation to tell it to `import('blah')` using async import rather than require()

3 messages · Page 1 of 1 (latest)

molten musk
#

Is there a way to do this? I have a module that mocks ESM, but it only works if the module ends up getting loaded via import() rather than via require().

I'm dual-building so that the mocking module can be loaded using either require() or import(), but in either case, I need it to actually call import(specifier) and not Promise.resolve(specifier).then(s => require(s))

#

Ah, found it, it's "moduleResolution": "node16"

#

thanks, rubber duck