Skip to content
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

Can't define multiple paths alias in typescript ? #8

Closed
arpitprod opened this issue Sep 9, 2020 · 1 comment
Closed

Can't define multiple paths alias in typescript ? #8

arpitprod opened this issue Sep 9, 2020 · 1 comment

Comments

@arpitprod
Copy link

arpitprod commented Sep 9, 2020

I'm moving my codebase javascript to typescript. It was working with javascript code but not working with typescript code and I want to use multiple alias. This is my code

const {alias} = require('react-app-rewire-alias')
module.exports = function override(config) {
alias({
"Components": './src/ui/components',
"Pages": './src/ui/pages',
"Theme": './src/ui/theme.js',
"Api": './src/core/api',
"Hooks": './src/core/hooks',
"Utils": './src/core/utils',
})(config)
return config
}

but it's showing error
Module not found: Can't resolve 'Theme' in '/Users/abc/Documents/pro/src'

These are related versions

"react": "^16.13.1",
"react-app-rewired": "^2.1.6",
"react-app-rewire-alias": "^0.1.6",
"react-dom": "^16.13.1",
"react-scripts": "^3.4.3",
"typescript": "^4.0.2",

Please tell what I'm doing wrong

@arpitprod arpitprod changed the title Can't define multiple paths alias Can't define multiple paths alias ? Sep 9, 2020
@arpitprod arpitprod changed the title Can't define multiple paths alias ? Can't define multiple paths alias in typescript ? Sep 9, 2020
@arpitprod
Copy link
Author

sorry, it was silly mistake from my side only.
theme filename is theme.ts and I'm writing theme.js in script.
"Theme": './src/ui/theme.js',
So, It's showing error Module not found: Can't resolve 'Theme' in '/Users/abc/Documents/pro/src'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant