asapach / babel-plugin-rewire-exports

Babel plugin for stubbing [ES6, ES2015] module exports
MIT License
66 stars 7 forks source link

Dedupe `restore` export #44

Closed rhysviz closed 10 months ago

rhysviz commented 10 months ago

I'm trying to use this in a project where I am upgrading to webpack 5. I am compiling my tests with webpack and it produces the following error:

Uncaught Error: Module parse failed: Duplicate export 'restore'

Is it possible to make the restore export related to the import name somehow to avoid this issue? i.e.

import { restoreModuleA } from 'module-a';
import { restoreSomePathFile } from '../some/path/file';
asapach commented 10 months ago

Could you please provide a more complete example with repro steps?

rhysviz commented 10 months ago

In trying to reproduce this I realised it was just an error resulting from quite a complicated webpack set up 😬

I was basically running babel (with rewire) twice on some files which explains the error.

Thanks for the library 😃