Edit

require

The require setting enable a Vike extension to declare its dependency on other Vike extensions and enforce users to install these.

// /node_modules/vike-react-query/dist/+config.js
 
export default {
  name: 'vike-react-query'
  require: {
    'vike': '>=1.0.0'
    'vike-react': '>=1.0.0'
  }
}

The version ranges use the same syntax as the dependencies property of package.json. (Vike uses the Node.js built-in package semver.)

We recommend to use both the peerDependencies property of package.json as well as this require setting.

The peerDependencies list isn't a reliable way to enforce dependencies: it usually only shows a warning that many users ignore.

provide

A Vike extension that implements the API of another Vike extension can declare it with the provide setting:

// /node_modules/vike-react-rsc/dist/+config.js
 
export default {
  name: 'vike-react-rsc',
  provide: {
    // vike-react-rsc implements the API of vike-react 0.6.31
    'vike-react': '0.6.31'
  }
}

The require: { 'vike-react': '>=0.6.4' } of other extensions (e.g. vike-react-query) is then met by vike-react-rsc, as if vike-react 0.6.31 were installed.

See also