The extensions.ts file is the central configuration file for all extensions in your Wix CLI project. This file must be located in the src/ directory and serves as the registry where you define and organize all the extensions that add functionality to your project.
The extensions.ts file uses a builder pattern syntax that allows you to chain extension configurations together. This approach provides a clean, readable way to manage multiple extensions in your project.
The extensions.ts file follows this basic structure:
The file:
@wix/astro/builders..use() method to register extensions.You can also import extension configurations from separate files and register them. For example:
extension.ts
my-imported-page.extension.ts
You can add extensions to your project using the generate command. After running this command and following the prompts, CLI:
extension.ts file containing the builder. By default, it uses the naming pattern [extension-name].extension.ts, however, you can rename these files to anything you want..use() method call to register the new extension in the extensions.ts file.When you delete an extension from your project, you should also remove its registration from the extensions.ts file. This involves removing both:
.use() method call that registers the extension.