You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, plugins are executed in the order of the package.json dependency list. Since these dependencies are automatically alphabetically sorted by yarn install, One plugin can suddenly break when renamed if it expect some other plugin to be executed before ( see https://stackoverflow.com/questions/65977135/how-to-change-chainwebpack-call-order-with-vue-js )
...This would also bring some determism to when each plugin is called
What does the proposed API look like?
An API could for example bring some kind of dependency graph across the plugins, like this :
First, the main export would be either a callback as it is currently, either an object.
if it is an object, it would look like this :
metaPlugin defaults to False. Indicates if callback will contains only calls to api.addPlugin() (defined below). If it is set, before, after and name should be left undefined/null/empty.
callback is equivalent to the current exported function.
If metaPlugin is not set :
name, if set is the name of group this plugin is part of. if not set, it defaults to the package name.
before and after are the requirement lists of the plugin in the dependency graph. (other plugin's name)
What problem does this feature solve?
Currently, plugins are executed in the order of the package.json dependency list. Since these dependencies are automatically alphabetically sorted by
yarn install
, One plugin can suddenly break when renamed if it expect some other plugin to be executed before ( see https://stackoverflow.com/questions/65977135/how-to-change-chainwebpack-call-order-with-vue-js )...This would also bring some determism to when each plugin is called
What does the proposed API look like?
An API could for example bring some kind of dependency graph across the plugins, like this :
First, the main export would be either a callback as it is currently, either an object.
if it is an object, it would look like this :
metaPlugin
defaults to False. Indicates ifcallback
will contains only calls to api.addPlugin() (defined below). If it is set,before
,after
andname
should be left undefined/null/empty.callback
is equivalent to the current exported function.If
metaPlugin
is not set :name
, if set is the name of group this plugin is part of. if not set, it defaults to the package name.before
andafter
are the requirement lists of the plugin in the dependency graph. (other plugin's name)Then an
addPlugin()
The fields have the same semantic as the exported object.
The plugin would be executed like this :
First, gather all (meta)plugin. Execute all meta-plugins "recursively" (a meta plugin can add another meta-plugin in its callback).
Then, solve the dep-graph and execute the remaining plugins. If not possible (cyclic dependencies), raise an error.
Example :
The text was updated successfully, but these errors were encountered: