Skip to main content

Bootstrap

bootstrap

Bootstraps the Vendure server. This is the entry point to the application.

Example

import { bootstrap } from '@vendure/core';
import { config } from './vendure-config';

bootstrap(config).catch(err => {
console.log(err);
process.exit(1);
});

Passing additional options

Since v2.2.0, you can pass additional options to the NestJs application via the options parameter. For example, to integrate with the Nest Devtools, you need to pass the snapshot option:

import { bootstrap } from '@vendure/core';
import { config } from './vendure-config';

bootstrap(config, {
nestApplicationOptions: {
snapshot: true,
}
}).catch(err => {
console.log(err);
process.exit(1);
});

Ignoring compatibility errors for plugins

Since v3.1.0, you can ignore compatibility errors for specific plugins by passing the ignoreCompatibilityErrorsForPlugins option.

This should be used with caution, only if you are sure that the plugin will still work as expected with the current version of Vendure.

Example

import { bootstrap } from '@vendure/core';
import { config } from './vendure-config';
import { MyPlugin } from './plugins/my-plugin';

bootstrap(config, {
// Let's say that `MyPlugin` is not yet compatible with the current version of Vendure
// but we know that it will still work as expected, and we are not able to publish
// a new version of the plugin right now.
ignoreCompatibilityErrorsForPlugins: [MyPlugin],
});
Signature
function bootstrap(userConfig: Partial<VendureConfig>, options?: BootstrapOptions): Promise<INestApplication>

Parameters

userConfig

parameter
Partial<VendureConfig>

options

BootstrapOptions

Additional options that can be used to configure the bootstrap process of the Vendure server.

Signature
interface BootstrapOptions {
nestApplicationOptions?: NestApplicationOptions;
ignoreCompatibilityErrorsForPlugins?: Array<DynamicModule | Type<any>>;
}

nestApplicationOptions

property
NestApplicationOptions

These options get passed directly to the NestFactory.create() method.

ignoreCompatibilityErrorsForPlugins

property
v3.1.0
Array<DynamicModule | Type<any>>
default:
[]

By default, if a plugin specifies a compatibility range which does not include the current Vendure version, the bootstrap process will fail. This option allows you to ignore compatibility errors for specific plugins.

This setting should be used with caution, only if you are sure that the plugin will still work as expected with the current version of Vendure.

Example

import { bootstrap } from '@vendure/core';
import { config } from './vendure-config';
import { MyPlugin } from './plugins/my-plugin';

bootstrap(config, {
ignoreCompatibilityErrorsForPlugins: [MyPlugin],
});