About the extensions.ts File

The Wix CLI is in Developer Preview and is subject to change.

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.

How the extensions.ts file works

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:

Copy

The file:

  • Imports the necessary builders from @wix/astro/builders.
  • Exports a default app configuration.
  • Uses the .use() method to register extensions.

Import-based registration

You can also import extension configurations from separate files and register them. For example:

extension.ts

Copy

my-imported-page.extension.ts

Copy

Automatic extension management

You can add extensions to your project using the generate command. After running this command and following the prompts, CLI:

  • Creates the extension's files and code, including an 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.
  • Adds the necessary import statement and .use() method call to register the new extension in the extensions.ts file.

Remove deleted extensions

When you delete an extension from your project, you should also remove its registration from the extensions.ts file. This involves removing both:

  • The import statement for any extension builders.
  • The .use() method call that registers the extension.

See also

Did this help?