CliPlugin[]
[]
Used to configure custom Modern.js framework plugins.
Refer to How to Develop Plugins for how to write custom plugins.
This option is used to configure framework plugins. If you need to configure other types of plugins, please choose the corresponding configuration method:
Modern.js has three types of plugins:
CLI plugins
, applicable to local development, compilation and construction stages, can extend various capabilities in the command line and compilation stages.Server plugins
, applicable to the server.Runtime plugins
, applicable to the front-end runtime.Currently, Modern.js has opened up the ability to customize CLI plugins, and Server plugins and Runtime plugins will be opened up later.
By default, custom plugins are executed in the order of the plugins
array, and the execution time of built-in Modern.js plugins is earlier than that of custom plugins.
When the plugin sets options that control the order, such as pre
and post
, the execution order will be adjusted based on the declared fields. Refer to Relationship between plugins for more information.
The following is an example of using CLI plugins.
To use plugins from npm registry, you need to first install the plugins , and import them in modern.config.ts
.
To use local plugins, import them directly using a relative path.
If the plugin provides some custom configuration options, they can be passed in as parameters to the plugin function.