返回 Skill 列表
extension
分类: 开发与工程无需 API Key

nuxt-modules

在创建Nuxt模块时使用:(1) 发布的npm模块 (@nuxtjs/,nuxt-),(2) 本地项目模块 (modules/ 目录),(3) 运行时扩展 (组件、组合式函数、插件),(4) 服务器端扩展 (API路由、中间件),(5) 向npm发布/发布模块,(6) 为模块设置CI/CD工作流。提供defineNuxtModule模式、Kit工具、钩子、端到端测试和发布自动化。

person作者: jakexiaohubgithub

Nuxt Module Development

Guide for creating Nuxt modules that extend framework functionality.

Related skills: nuxt (basics), vue (runtime patterns)

Quick Start

npx nuxi init -t module my-module
cd my-module && npm install
npm run dev        # Start playground
npm run dev:build  # Build in watch mode
npm run test       # Run tests

Available Guidance

Loading Files

Consider loading these reference files based on your task:

DO NOT load all files at once. Load only what's relevant to your current task.

Module Types

| Type | Location | Use Case | | --------- | ---------------- | -------------------------------- | | Published | npm package | @nuxtjs/, nuxt- distribution | | Local | modules/ dir | Project-specific extensions | | Inline | nuxt.config.ts | Simple one-off hooks |

Project Structure

my-module/
├── src/
│   ├── module.ts           # Entry point
│   └── runtime/            # Injected into user's app
│       ├── components/
│       ├── composables/
│       ├── plugins/
│       └── server/
├── playground/             # Dev testing
└── test/fixtures/          # E2E tests

Resources