Closed dagolinuxoid closed 2 years ago
Import-js will make an attempt at finding named exports from a module, but it won't always do so. In the case of react-router-dom, I can't find a reference to Route
or Redirect
in the module's main js file. That doesn't mean the export isn't there, just that it's harder to find. It will most likely involve executing/running the code which import-js won't do (for performance and complexity reasons).
Glad you found a workaround!
Do you think we should update the docs a little for this? Perhaps we should mention namedExports
as a solution in relation to the Since import-js ...
line. If so, would you be able to take it on and file a PR?
Apparently I need this for some modules. For example { connect } from 'react-redux', React from 'react' libraries and others imported as expected. But things from 'react-router-dom' gave me a headache =). My package.json is valid and has 'react-router-dom' as a dependency library. The solution is
I don't know what is special with the particular library but with the settings importing works.