mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-21 03:57:51 +02:00
feat(core): allow plugins to self-disable by returning null (#10286)
This commit is contained in:
parent
8c2943421b
commit
80203b385d
13 changed files with 181 additions and 86 deletions
|
@ -11,14 +11,15 @@ import type {PluginOptions, Options} from './options';
|
|||
export default function pluginVercelAnalytics(
|
||||
context: LoadContext,
|
||||
options: PluginOptions,
|
||||
): Plugin {
|
||||
const isProd = process.env.NODE_ENV === 'production';
|
||||
|
||||
): Plugin | null {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
name: 'docusaurus-plugin-vercel-analytics',
|
||||
|
||||
getClientModules() {
|
||||
return isProd ? ['./analytics'] : [];
|
||||
return ['./analytics'];
|
||||
},
|
||||
|
||||
contentLoaded({actions}) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue