Closed benamar closed 7 years ago
This might be caused by the order of execution of plugins/presets. I'll take a look.
@benamar, add-module-exports
plugin is incompatible with rewire-exports
since it overwrites exports in a different way.
If I reverse the plugin order like this: ['rewire-exports', 'add-module-exports']
it produces the output similar to this one:
exports.rewire = rewire;
exports.restore = restore;
exports.default = _default;
But when I do it your way (['add-module-exports', 'rewire-exports']
) it changes like this:
exports.rewire = rewire;
exports.restore = restore;
exports.default = _default;
module.exports = exports['default'];
Notice that all exports except default
are now gone.
I would recommend not mixing the two plugins together.
Hello, I can't make it work! Here is my .babelrc { "presets": [ "es2015", "stage-0" ], "plugins": [ 'add-module-exports', 'transform-decorators-legacy', 'rewire-exports' ] }
in my test I just add this : import {rewire,restore} from 'request-promise'; log(rewire) => undefined
Please can you tell me what am I doing wrong then?