How to configure import alias
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 32/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript, webpack
- Domain
- build-system, cli
Research direction
Start with the README section describing aliases and the package.json alias configuration, then compare those instructions with the reported tsconfig.json paths and the failing @Components/MyComponent import. Confirm the supported alias setup and whether the documented configuration produces a resolvable import; done means the behavior or instructions clearly allow that import to resolve.
Written by the indexing model from the issue text.
Description
I wanted to add alias import in an Enact project: i configured the tsconfig.json like bellow:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"paths": {
"@App/*": ["./src/App/*"],
"@Components/*": ["./src/Components/*"],
"@Views/*": ["./src/Views/*"]
},
},
"include": [
"src",
"types"
]
}
and i saw in readme that there is alias that can be added to the enact object in package.json:
"alias": {
"@App/*": ["./src/App/*"],
"@Components/*": ["./src/Components/*"],
"@Views/*": ["./src/Views/*"]
}
i don't if it's the right way to it or alias import is not available in Enact but when i make import like:
import MyComponent from '@Components/MyComponent
It said can't resolve @Components/MyComponent.
- Dominant language
- JavaScript
- Stars
- 14
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from enactjs/cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·