Using path aliases in VuePress 2 #169
-
How does someone use aliases in VuePress 2? I now am using: import '../../../../../../components/SomeAwesomeComponent.vue'; but it would be much better to read and more maintainable if I could do: import '@components/SomeAwesomeComponent.vue'; I have already tried to alter my // src/tsconfig.json
{
"extends": "../tsconfig.base.json",
"include": [".vuepress/**/*"],
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@components/*": [
"./.vuepress/theme/components/*"
]
}
}
} but am still getting the following error:
Also tried to do things with configureWebpack and chainWebpack, but didn't find a solution. How do I set up my aliases? Bonus points if someone could help me with aliases in Stylus as well. I am currently using the following approach in // src/.vuepress/config.ts
const config: UserConfig<DefaultThemeOptions, WebpackBundlerOptions> = {
/* ... */
bundlerConfig: {
stylus: {
stylusOptions: {
include: [path.resolve(__dirname, "theme", "styles")],
},
},
},
/* ... */ i.e. now |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
https://vuepress2.netlify.app/reference/plugin-api.html#alias |
Beta Was this translation helpful? Give feedback.
https://vuepress2.netlify.app/reference/plugin-api.html#alias