hades255 / angela-pm-fe

Chat app for the admin
1 stars 0 forks source link

Bundle path in react app development #2

Closed hades255 closed 6 hours ago

hades255 commented 6 hours ago

bundle path to make components reusable and flexible to expand

hades255 commented 6 hours ago

install react-app-rewired node module

npm i react-app-rewired
yarn add react-app-rewired
hades255 commented 6 hours ago

update scripts on package.json file

"scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test",
    "eject": "react-app-rewired eject"
  },
hades255 commented 6 hours ago

make new file named config-overrides.js on the root directory

const { configPaths, alias } = require('react-app-rewire-alias')
module.exports = alias(configPaths('./jsconfig.json'))
hades255 commented 6 hours ago

make new file named jsconfig.json on the root directory

{
  "compilerOptions": {
    "paths": {
      "@icons/*": ["./src/assets/icons/*"]
    }
  },
  "include": ["src"]
}
hades255 commented 6 hours ago

use it on the components

import { BellIcon, DownVectorIcon, MarkIcon } from '@icons'