plugins

  • Type: CliPlugin[]
  • Default: []

Used to configure custom Modern.js framework CLI plugins. For information on how to create custom CLI plugins, please refer to How to Write CLI Plugins.

Note

This option is specifically for configuring framework CLI plugins. If you need to configure other types of plugins, use the appropriate configuration method:

Examples

Below are examples of using CLI plugins:

Using plugins from npm

To use plugins from the npm registry, first install the plugins and then import them in your configuration:

modern.config.ts
import { myPlugin } from 'my-plugin';

export default defineConfig({
  plugins: [myPlugin()],
});

Using local plugins

To use plugins from your local repository, import them directly using a relative path:

modern.config.ts
import { myPlugin } from './config/plugin/myPlugin';

export default defineConfig({
  plugins: [myPlugin()],
});

Plugin configuration

If a plugin provides custom configuration options, pass them as parameters to the plugin function:

modern.config.ts
import { myPlugin } from 'my-plugin';

export default defineConfig({
  plugins: [
    myPlugin({
      foo: 1,
      bar: 2,
    }),
  ],
});