Answer the question
In order to leave comments, you need to log in
Why doesn't alias work in html without ~?
Hello!
Alias does not work in html without ~, and if you put it, then webstorm does not understand it. Alias work fine in js, ts without ~ and webstorm understands everything, but not in html.
Here is the whole source code:
tsconfig.json:
{
"compilerOptions": {
"baseUrl": "./src/",
"paths": {
"@components/*": [
"components/*"
],
"@assets/*": [
"static/assets/*"
]
}
}
}
{
"compilerOptions": {
"baseUrl": "./src/",
"paths": {
"@components/*": [
"components/*"
],
"@assets/*": [
"static/assets/*"
]
}
}
}
resolve: {
modules: [
path.resolve(__dirname, 'node_modules')
],
alias: {
'@components': path.resolve(__dirname, './src/components'),
'@assets': path.resolve(__dirname, './src/static/assets')
},
extensions: ['.ts', '.js']
},
<div class="header">
<div class="header__logo">
<img src="@assets/images/1.jpg" alt=""> // Не работает
<img src="[email protected]/images/1.jpg" alt=""> // Работает
</div>
</div>
import { header } from '@components/header/header'
export function footer () {
header()
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question