Browse Source

docs: Improve populate script example

Michael Bromley 4 years ago
parent
commit
5e52415ee0
1 changed files with 10 additions and 1 deletions
  1. 10 1
      docs/content/developer-guide/importing-product-data.md

+ 10 - 1
docs/content/developer-guide/importing-product-data.md

@@ -128,7 +128,7 @@ The `@vendure/core` package exposes a [`populate()` function]({{< relref "popula
 
 ```TypeScript
 // populate-server.ts
-import { bootstrap } from '@vendure/core';
+import { bootstrap, DefaultJobQueuePlugin } from '@vendure/core';
 import { populate } from '@vendure/core/cli';
 
 import { config } from './vendure-config.ts';
@@ -136,6 +136,15 @@ import { initialData } from './my-initial-data.ts';
 
 const productsCsvFile = path.join(__dirname, 'path/to/products.csv')
 
+const populateConfig = {
+  ...config,
+  plugins: (config.plugins || []).filter(
+    // Remove your JobQueuePlugin during populating to avoid
+    // generating lots of unnecessary jobs as the Collections get created.
+    plugin => plugin !== DefaultJobQueuePlugin,
+  ),
+}
+
 populate(
   () => bootstrap(config),
   initialData,