Remove Theme.js Code Duplication [Refactoring]
shravan20 opened this issue · 3 comments
Is your feature request related to a problem? Please describe.
Constant Values stored as JSON values are duplicated across the frontend and backend version.
Describe the solution you'd like
Remove the duplicated version inside the /frontend/src/util/themes/index.js file and use the existing backend-version file
Hi, I removed /frontend/src/util/themes/index.js
and tried to import backend version, but encountered this error.
./src/components/organisms/TemplateCard/index.js
Module not found: You attempted to import ../../../../../src/themes/themes which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
This is because Create React App does not allow frontend code to import outside /src directory.
Links below have some workaround. (the simplest one should be to delete backend const file and backend code imports frontend const file instead). Do you have any solution in your mind?
Reference
https://stackoverflow.com/questions/44114436/the-create-react-app-imports-restriction-outside-of-src-directory
https://stackoverflow.com/questions/59571680/react-backend-project-structure-when-sharing-code
Hi, we can import the themes into theme.js and export it again from the same file.
looking for my first contribution in open source, can anyone guide me where to start with the issue. i would love to work on it