New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack 5 will not accept duplicated exports names #514
Comments
CRA v5 has been released, any solutions to this? |
If you mean a solution to properly fix it, the most obvious is to derivate all the names of the old IO icons for example this way:
If rather, you mean a quick patch while a clean definitive solution is released, then I don't see any for now . |
+1 |
did someone found a solution/workaround? |
Well, if you have ejected the Webpack config file from your react app, it seems you could use https://www.npmjs.com/package/file-replace-loader to replace the problematic file If you haven't ejected it yet, Edit 1 : There is actually a way without ejecting webpack: https://www.npmjs.com/package/react-app-rewired Hopefully, this will be fixed soon as it's quite a serious concern, and it's gonna be more and more problematic by people upgrading Edit 2: I ended up creating a proxy to access the library : https://github.com/korbav/files/blob/main/react/react-icons/react-icons-proxy.js Instead of importing your icons from Eg: The lib updates have been on standby for a while though, I'm not sure how often the issues are fetched by the maintainers. |
I have the same problem after updating react, react-router-dom and react-scripts. |
Hi @MihailProcudin, please see the second edit in my post above, it's a working workaround waiting for the library to release a permanent clean fix. |
@korbav Ah, your solutions are amazing 👍 |
+1 I also faced the exact same issue today. |
A simple workaround - import the icons from their respective folder instead of from '/all'. i.e.
instead of
|
Same issue solved temporarily with korbav`s proxy workaround, waiting for a definitive solution |
i also face this problem can you please suggest me any soluion regarding that thank you |
Solution 1Use Vite builder instead of Webpack Solution 2just create a reactIcons.ts file and export only below libraries and then you can import reactIcons.ts file instead of "react-icons/all" export * from 'react-icons/ci';
export * from 'react-icons/fa';
export * from 'react-icons/io';
export * from 'react-icons/md';
export * from 'react-icons/ti';
export * from 'react-icons/go';
export * from 'react-icons/fi';
export * from 'react-icons/gi';
export * from 'react-icons/wi';
export * from 'react-icons/di';
export * from 'react-icons/ai';
export * from 'react-icons/bs';
export * from 'react-icons/ri';
export * from 'react-icons/fc';
export * from 'react-icons/gr';
export * from 'react-icons/hi';
export * from 'react-icons/si';
export * from 'react-icons/sl';
export * from 'react-icons/im';
export * from 'react-icons/bi';
export * from 'react-icons/cg';
export * from 'react-icons/vsc';
export * from 'react-icons/tb';
export * from 'react-icons/tfi';
export * from 'react-icons/rx'; example: import * as icons from './reactIcons'
interface IProps {
iconName: string
}
const ReactIcon = ({iconName}: IProps) => {
let Icon = _.get(icons, iconName)
return React.createElement(Icon)
}
export default ReactIcon <ReactIcon iconName={'FaReact'} /> |
Describe the problems
create-react-app@next
will now be usingWebpack 5
instead ofWebpack 4
.This brings an increased level of requirements when it comes to exports,
react-icons
is using the same star exports names for bothio
andio5
which prevents Webpack to build the app (an exception being thrown).Minimal sample repository
Any react app using
create-react-app@next
Expected behavior
The compilation should not be blocked because of duplicated exports names.
Errors
The text was updated successfully, but these errors were encountered: