requireify
requireify copied to clipboard
ES6 export default not supported
Hi, we are using ES6 Modules and I'm noticing that requireify
is unable to require()
modules that use export default
. Any thoughts on how to fix this or if there is a work around?
Thanks for the issue @richard-flosi!
I need to think about it a little bit. What transform are you using to bundle ES2015 modules? Also, what is requireify bringing into the console when using this transform? Are you getting an object that's structured like
{
default: {OBJ YOU REALLY WANT}
}
?
Hi @johnkpaul I get back undefined
. I would expect to get back the default object without it under a default
key. I'm using .transform(requireify, {global: true})
as my transform.
e.g.
# foo.js
export default {
foo: 'bar',
};
For exports like the following it works as expected:
const foo = {foo: 'bar'};
exports {
foo,
};