Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5058

Nuxt3 aliases for directories in nuxtconfig

$
0
0

I would like to create aliases for some directories in a Nuxt 3 project, however, I was not able to make them work just from the information provided in the documentation.

I've tried registering them like this:

export default defineNuxtConfig({    alias {"@scss": "/<rootDir>/assets/scss",    }})

as well as like this:

import {fileURLToPath} from "url";export default defineNuxtConfig({    alias {"@scss": fileURLToPath(new URL('./assets/scss', import.meta.url)),    }})

and then using them in vue components like this:

<style lang="scss">@use "~@sass/............";    // one way (because the documentation says sth about prefixing it with '~'@use "@sass/............";</style>

and as you can probably imagine, it did not work 😅.

What is the proper way to register an alias for a folder and then use it in css, javascript & template markup?


Viewing all articles
Browse latest Browse all 5058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>