Dependency Management
In NocoBase plugin development, dependencies are divided into two categories: plugin dependencies and global dependencies.
- Global dependencies: Provided by
@nocobase/serverand@nocobase/client-v2, plugins don't need to bundle them separately. - Plugin dependencies: Plugins' unique dependencies (including server-side dependencies) will be bundled into the plugin artifacts.
Development Principles
Since plugin dependencies will be bundled into the plugin artifacts (server dependencies will be bundled into dist/node_modules), you can declare all dependencies in devDependencies instead of dependencies. This avoids differences between development and production environments.
When a plugin needs to use the following dependencies, make sure the version number matches the global dependencies in @nocobase/server and @nocobase/client-v2, otherwise runtime conflicts may occur.
Global Dependencies
The following dependencies are provided by NocoBase and don't need to be bundled in plugins. If you do need to use them, they should match the NocoBase version.
Development Recommendations
-
Maintain Dependency Consistency
If a package already exists in global dependencies, just use the global version — don't install a different version. -
Minimize Bundle Size
Common UI libraries (such asantd), utility libraries (such aslodash), and database drivers (such aspg,mysql2) should all use the globally provided versions to avoid duplicate bundling. -
Consistency Between Debug and Production Environments
UsingdevDependenciesensures consistency between development and final artifacts, avoiding environment differences caused by improper configuration ofdependenciesandpeerDependencies.
Related Links
- Build and Package — Plugin build and packaging configuration
- Project Structure — Plugin file organization
- Write Your First Plugin — Create a plugin from scratch
- Plugin Development Overview — Overall introduction to plugin development

