add absolute paths

This commit is contained in:
Sergey Krylov 2022-07-25 08:01:24 +05:00
parent aff0ac7330
commit 6c466d95a1
3 changed files with 28 additions and 12 deletions

16
config-overrides.js Normal file
View File

@ -0,0 +1,16 @@
const path = require('path');
module.exports = function override(config) {
console.log('Aliases before', config.resolve.alias);
config.resolve = {
...config.resolve,
alias: {
...config.alias,
'components': path.resolve(__dirname, 'src/components'),
'context': path.resolve(__dirname, 'src/context'),
'src': path.resolve(__dirname, 'src')
},
};
console.log('CONFIG', config);
return config;
};

View File

@ -13,10 +13,10 @@
"uuid": "^8.3.2"
},
"scripts": {
"start": "cross-env BROWSER=none PORT=8080 react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"start": "cross-env NODE_PATH=src BROWSER=none PORT=8080 react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject"
},
"eslintConfig": {
"extends": [
@ -38,6 +38,7 @@
},
"devDependencies": {
"cross-env": "^7.0.3",
"react-app-rewired": "^2.2.1",
"react-scripts": "^5.0.1",
"typescript": "^4.7.4"
}

View File

@ -1,5 +1,6 @@
{
"compilerOptions": {
"baseUrl": "./",
"target": "es5",
"lib": [
"dom",
@ -19,15 +20,13 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
// "paths": {
// "components/*": ["src/components/*"],
// "core/*": ["src/core/*"],
// "pages/*": ["src/pages/*"],
// "redux/*": ["src/redux/*"],
// "src/*": ["src/*"],
// }
"paths": {
"components/*": ["src/components/*"],
"context/*": ["src/context/*"],
"src/*": ["src/*"],
}
},
"include": [
"src"
]
],
}