thlorenz/proxyquire

Cannot read property 'require' of undefined when using ES6 modules

Closed this issue · 5 comments

Proxyquire works with require only and doesn't support ES Modules.

Thanks for the feedback.

pabx06 commented

I Have the same issue. ES6 module is getting more and more popular...

Same here. This forces us to switch to another library.

@sokraflex I looked into this earlier this year and I don't think anyone can support stubbing ESM imports by transforming them into CJS. IIRC, it seems like everything that transpiles into CJS from ESM implements the literal standard, which is to return your module as a getter only, which means it's never allowed to be set. You'll never get to stub.