Skip to content

Plugins

Pavel Zhukov edited this page Dec 12, 2020 · 12 revisions

StartupJS Plugins

A startupjs library might use StartupJS plugin API to simplify its integration into StartupJS projects.

In the library's root folder, create a startupjs.config.cjs file which should export an object:

module.exports = {
  type: 'plugin',
  bundler: {
    forceCompile: {
      web: true,
      server: true
    }
  }
}

The available options are described below:

type *REQUIRED

string

Type of library. Must be plugin

type: 'plugin'

bundler

Adjust the bundling and compiling process of startupjs project.

bundler.forceCompile

object

Specify whether the library should be force compiled on server and/or web:

bundler: {
  forceCompile: {
    web: true,
    server: true
  }
}

You can also pass an array of strings with the library names instead of true, in this case all of the listed libraries are gonna be force compiled. Note that in this case you also need to specify the library's self name too:

bundler: {
  forceCompile: {
    web: ['my-startupjs-library', 'react-native-collapsible'],
    server: true // this will compile only the library itself (`my-startupjs-library`) on server
  }
}

Dependencies

Startupjs plugins which are dependencies of other startupjs plugins gets parsed automatically. Module is considered to be a startupjs plugin if it has startupjs.config.cjs with at least the following configuration:

module.exports = {
  type: 'plugin'
}

So if your module doesn't need to do any special startupjs configuration, but you depend on other startupjs plugins, you still have to create the minimal startupjs.config.cjs.

Clone this wiki locally