Nuxt.js module to add module alias
npm install @anymud/nuxt-module-aliasThis package addresses an issue where Nuxt 3 modules do not support aliases due to the Jijt environment's inability to respond to tsconfig.json. By leveraging the module-alias package, @anymud/nuxt-module-alias adds the necessary aliases at the very start of your Nuxt project, ensuring smoother development experience with TypeScript support.
- Easy alias setup for Nuxt 3 projects
- Supports TypeScript configuration
- Simplifies project structure management
You can install @anymud/nuxt-module-alias using npm, pnpm, yarn, or bun. Choose the command corresponding to your package manager:
``bashnpm
npm install @anymud/nuxt-module-alias
Usage
To use
@anymud/nuxt-module-alias, add the module to the beginning of the modules array in your nuxt.config.ts file:`ts
export default defineNuxtConfig({
modules: [
'@anymud/nuxt-module-alias',
// Other modules...
],
})
`This setup ensures that alias resolution is applied before any other module logic, allowing for seamless integration with your project's existing structure.
$3
After setting up @anymud/nuxt-module-alias, you should see output similar to the following, indicating that the aliases have been successfully added:`console
ℹ Setting up alias ...
✔ Adding alias ~ -> /home/kyle/anymud/src
✔ Adding alias @ -> /home/kyle/anymud/src
✔ Adding alias ~~ -> /home/kyle/anymud
✔ Adding alias @@ -> /home/kyle/anymud
✔ Adding alias assets -> /home/kyle/anymud/src/assets
✔ Adding alias public -> /home/kyle/anymud/src/public
✔ Adding alias cookie -> cookie
✔ Adding alias #app -> /home/kyle/anymud/node_modules/nuxt/dist/app
✔ Adding alias vue-demi -> /home/kyle/anymud/node_modules/nuxt/dist/app/compat/vue-demi
✔ Adding alias @vue/composition-api -> /home/kyle/anymud/node_modules/nuxt/dist/app/compat/
✔ Alias setup complete
This output verifies that the necessary aliases have been correctly added to your project, simplifying your development workflow.
`Configuration
Currently,
@anymud/nuxt-module-alias does not require additional configuration. It works out-of-the-box by leveraging your existing tsconfig.json paths. However, future versions may introduce customizable options for enhanced flexibility.Contributing
Contributions are always welcome! If you'd like to contribute, please follow these steps:
1. Fork the repository.
2. Create your feature branch (
git checkout -b feature/AmazingFeature).
3. Commit your changes (git commit -m 'Add some AmazingFeature').
4. Push to the branch (git push origin feature/AmazingFeature).
5. Open a Pull Request.Please make sure to update tests as appropriate.
License
Distributed under the MIT License. See
LICENSE for more information.Acknowledgments
- Thanks to the Nuxt team for creating an extensible and powerful framework.
- Appreciation to the creators of
module-alias` for providing the tooling to make this package possible.For support, open an issue or submit a pull request. Please describe your problem or contribution as clearly as possible.