Skip to content

Bundling Scripts

Sometimes you are going to want to make larger scripts spanning multiple files, or you may want to use external dependencies from npm. In that case, you’re going to want to bundle your script. Gimloader provides a preconfigured bundler at @gimloader/build.

Quickstart

To get started, make sure you have Node.js installed and then run this command wherever you want to make your project.

Terminal window
npm create @gimloader

Then, fill out the questions asked, cd into the directory you provided, and you’re good to go!

Usage

To build your script once, run npx gl build. To automatically rebuild the script whenever changes are made, run npx gl serve. This will also attempt to automatically install it on Gimloader if you enable “Poll for plugins/libraries being served locally” in settings and leave it open. Running npx gl serve -m acts the same, but rather than rebuilding whenever changes are made it will rebuild when you press enter in the terminal.

Configuration

Configuration for the bundler is housed at GL.config.js. The following options are available:

NameRequiredPlugin Only?Purpose
inputYesNoWhich file to input to the bundler, for example src/index.js
nameYesNoThe script’s name
descriptionYesNoA description of what the script does
authorYesNoWho made the script
versionNoNoThe version of the script, used for updates
downloadUrlNoNoWhere a raw version of the script be found, used for updates
webpageNoNoA webpage where users can get more information about the script.
reloadRequiredNoNoWhether the page needs to reload after a script is installed for it to work. Set to true for always, set to ingame for only when a game is currently active.
hasSettingsNoYesWhether a plugin has a settings menu, used to show it does when it’s disabled
libsNoYesAn array of libraries the plugin needs to be enabled to work, formatted like [Name] | [Url]
optionalLibsNoYesThe same as libs, but the plugin will still work without these and will not try to automatically download them
isLibraryNoNoSet to true when making a library
pluginsNoNoAn array of esbuild plugins to use
esbuildOptionsNoNoAny additional settings to pass to esbuild

A GL.config.js file might look something like

export default {
name: "MyPlugin",
description: "Does Something",
author: "Me",
version: "1.0.0"
}

Using the Api

In order to best use the Gimloader api you should import it from the the gimloader npm package. This is automatically installed when running npm create @gimloader.

// scoped
import GL from 'gimloader';
// unscoped
import GL from 'gimloader/global';