-
-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Closed
Description
My solution:
yarn add react-app-rewired --devUpdate
package.jsonscripts:"scripts": { "start": "react-app-rewired start", "build": "react-app-rewired build", "test": "react-app-rewired test --env=jsdom", "eject": "react-app-rewired eject" },Add
config-overrides.jsto project root:const path = require('path'); module.exports = function override(config) { config.resolve = { ...config.resolve, alias: { '@': path.resolve(__dirname, 'src') }, }; return config; };Add
jsconfig.paths.json/tsconfig.paths.jsonto project root:{ "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["src/*"] } } }Add the following to
jsconfig.json/tsconfig.json:"extends": "./tsconfig.paths.json", // or jsconfig.paths.jsonCRA warns about
compilerOptions.baseUrlandcompilerOptions.pathsnot being supported but everything works as expected.
Thanks for your solution. One silly question, how I can use to solution to avoid using '@'? I mean, instead of doing `@/components/DummyComponent' I would like to do 'components/DummyComponent'.
Originally posted by @jjvainstein in #5118 (comment)
huybn5776
Metadata
Metadata
Assignees
Labels
No labels