More Premium Hugo Themes Premium Nuxt Themes

Components

Scan and auto import components for Nuxt.js 2.13+

Components

Scan and auto import components for Nuxt.js 2.13+

Author Avatar Theme by nuxt
Github Stars Github Stars: 883
Last Commit Last Commit: Nov 12, 2021 -
First Commit Created: Dec 18, 2023 -
Components screenshot

Overview:

The @nuxt/components module is a tool that allows for the automatic scanning and importing of components in Nuxt 2.13+. It eliminates the need to manually import components and provides features such as lazy loading, code-splitting optimization, and hot reloading. This module is particularly useful for library authors or developers working on large-scale projects with many components.

Features:

  • Automatically scan components directory
  • No need to manually import components anymore
  • Supports multiple paths with customizable prefixes and lookup/ignore patterns
  • Lazy loading of components
  • Production code-splitting optimization
  • Hot reloading
  • Integration with other modules
  • Fully tested

Installation:

To use the @nuxt/components module, follow these steps:

  1. Install the module via npm:
npm install @nuxt/components
  1. Add @nuxt/components to the buildModules section of your nuxt.config.js file:
export default {
  buildModules: [
    '@nuxt/components'
  ]
}
  1. Create your components in the designated directory (by default, ~/components).

  2. Use the components in your .vue files without manually importing them in the script section.

For more information on usage and customization options, refer to the official documentation.

Summary:

The @nuxt/components module is a powerful tool that simplifies the process of importing and managing components in Nuxt projects. It eliminates the need for manual imports and provides features such as lazy loading and code-splitting optimization. This module is highly recommended for developers working on projects with large numbers of components or for library authors looking to streamline the integration of their components into Nuxt applications.