Last active
January 31, 2020 11:17
-
-
Save adrianjost/46d17993266d9a6d6b058b4b953f34c9 to your computer and use it in GitHub Desktop.
NuxtJS Theming - Component Alias - https://medium.com/p/2567ef5b5b6a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const aliases = { | |
// required to not break nuxt | |
"@": "src", | |
"@@": ".", | |
// custom aliases | |
"@components": "src/components", | |
} | |
// export resolved aliases | |
for (const alias in aliases) { | |
module.exports[alias] = path.resolve(__dirname, aliases[alias]) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// nuxt.config.js | |
export default { | |
build: { | |
extend(config, ctx) { | |
Object.assign(config.resolve.alias, require("./aliases.config")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment