wix-cli-extension-registration by wix/skills
npx skills add https://github.com/wix/skills --skill wix-cli-extension-registration创建任何扩展文件后,您必须更新主 src/extensions.ts 文件,以向应用注册该扩展。
Wix CLI 通过 src/extensions.ts 文件发现扩展——它是告知构建系统存在哪些扩展的单一入口点。如果没有注册:
"我的扩展不工作"的最常见原因就是此文件中缺少 .use() 调用。
src/extensions.ts - 直接导入并注册扩展:
import { app } from "@wix/astro/builders";
import { dataExtension } from "./extensions/data/extensions.ts";
import { dashboardpageMyPage } from "./extensions/dashboard/pages/my-page/extensions.ts";
import { embeddedscriptMyScript } from "./extensions/site/embedded-scripts/my-script/extensions.ts";
export default app()
.use(dataExtension)
.use(dashboardpageMyPage)
.use(embeddedscriptMyScript);
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
每个新扩展的步骤:
extensions.ts 文件导入扩展.use(extensionName) 添加到应用链中src/index.ts - 重新导出所有扩展:
export { dashboardpageMyPage } from "./extensions/dashboard/pages/my-page/extensions";
export { embeddedscriptMyScript } from "./extensions/site/embedded-scripts/my-script/extensions";
export { dataExtension } from "./extensions/data/extensions";
src/extensions.ts - 以编程方式注册所有扩展:
import { app } from "@wix/astro/builders";
import * as allExtensions from "./index";
const extensionList = Object.values(allExtensions);
const appBuilder = app();
extensionList.forEach((extension) => {
appBuilder.use(extension);
});
export default appBuilder;
以下扩展类型不需要 extensions.ts 文件:
扩展导出名称遵循此模式:{extensiontype}{CamelCaseName}
示例:
dashboardpageCartPopupManagerdashboardpluginBlogPostsBannerdashboardmenupluginExportPostsembeddedscriptCouponPopupsitewidgetCountdownWidgetsitepluginProductBadgeecomshippingratesCustomShipping类型前缀是小写的扩展类型,没有分隔符。
| 症状 | 原因 | 修复方法 |
|---|---|---|
| 扩展完全未出现 | 缺少 .use() 调用 | 将导入和 .use(extensionName) 添加到 src/extensions.ts |
| 构建时出现"Cannot find module" | 导入路径错误 | 验证导入中的路径是否与实际文件位置匹配(相对于 src/) |
| 扩展已注册但不工作 | 导出名称不匹配 | 确保扩展文件中的导出名称与 extensions.ts 中的导入名称匹配 |
| 多个扩展,只有部分工作 | 链不完整 | 检查每个扩展是否同时有导入和 .use() 调用 |
.use() 上的 TypeScript 错误 | 导出类型错误 | 确保扩展文件使用了正确的构建器方法(例如,extensions.dashboardPage() 而不是 extensions.embeddedScript()) |
每周安装数
183
仓库
GitHub 星标数
3
首次出现
2026年2月3日
安全审计
安装于
opencode162
cursor88
codex83
gemini-cli81
github-copilot78
kimi-cli73
After creating any extension file, you must update the main src/extensions.ts file to register the extension with the app.
The Wix CLI discovers extensions through the src/extensions.ts file — it's the single entry point that tells the build system which extensions exist. Without registration:
The most common cause of "my extension isn't working" is a missing .use() call in this file.
src/extensions.ts - Import and register extensions directly:
import { app } from "@wix/astro/builders";
import { dataExtension } from "./extensions/data/extensions.ts";
import { dashboardpageMyPage } from "./extensions/dashboard/pages/my-page/extensions.ts";
import { embeddedscriptMyScript } from "./extensions/site/embedded-scripts/my-script/extensions.ts";
export default app()
.use(dataExtension)
.use(dashboardpageMyPage)
.use(embeddedscriptMyScript);
Steps for each new extension:
extensions.ts file.use(extensionName) to the app chainsrc/index.ts - Re-export all extensions:
export { dashboardpageMyPage } from "./extensions/dashboard/pages/my-page/extensions";
export { embeddedscriptMyScript } from "./extensions/site/embedded-scripts/my-script/extensions";
export { dataExtension } from "./extensions/data/extensions";
src/extensions.ts - Register all extensions programmatically:
import { app } from "@wix/astro/builders";
import * as allExtensions from "./index";
const extensionList = Object.values(allExtensions);
const appBuilder = app();
extensionList.forEach((extension) => {
appBuilder.use(extension);
});
export default appBuilder;
The following extension types do not require extensions.ts files:
Extension export names follow this pattern: {extensiontype}{CamelCaseName}
Examples:
dashboardpageCartPopupManagerdashboardpluginBlogPostsBannerdashboardmenupluginExportPostsembeddedscriptCouponPopupsitewidgetCountdownWidgetsitepluginProductBadgeecomshippingratesCustomShippingThe type prefix is the extension type in lowercase with no separators.
| Symptom | Cause | Fix |
|---|---|---|
| Extension not appearing at all | Missing .use() call | Add import and .use(extensionName) to src/extensions.ts |
| "Cannot find module" on build | Wrong import path | Verify the path in your import matches the actual file location (relative to src/) |
| Extension registered but not working | Export name mismatch | Ensure the exported name in the extension file matches the import in extensions.ts |
| Multiple extensions, only some work | Incomplete chain | Check that every extension has both an import and a call |
Weekly Installs
183
Repository
GitHub Stars
3
First Seen
Feb 3, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode162
cursor88
codex83
gemini-cli81
github-copilot78
kimi-cli73
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
116,600 周安装
.use()TypeScript error on .use() | Wrong export type | Ensure extension file uses the correct builder method (e.g., extensions.dashboardPage() not extensions.embeddedScript()) |