rollup-plugin-screeps-world
raw JSON → 1.0.4 verified Fri May 01 auth: no javascript
A Rollup plugin for deploying code to the Screeps MMO game world. Version 1.0.4 is the latest stable release, updated sporadically. It automates uploading compiled JavaScript bundles to Screeps servers via the official API, with support for automatic branch naming from Git, source map uploading, and config file-based authentication. Unlike generic upload plugins, this is purpose-built for Screeps' unique upload protocol and branch system. It ships TypeScript types.
Common errors
error Error: Unexpected token 'export' ↓
cause Using CommonJS require() on ESM-only package.
fix
Change to import syntax:
import screeps from 'rollup-plugin-screeps-world' error TypeError: screeps is not a function ↓
cause Using default import incorrectly (e.g., `{ screeps }` instead of `screeps`).
fix
Use
import screeps from 'rollup-plugin-screeps-world' error Error: ENOENT: no such file or directory, open './screeps.json' ↓
cause The config file path is misconfigured or missing.
fix
Ensure the file exists at the specified path, or provide inline options.
error Error: Invalid credentials (401) ↓
cause Wrong email or password in config file.
fix
Verify credentials in screeps.json or environment variables.
Warnings
breaking The plugin is ESM-only from v1.0.0. Using require() will fail. ↓
fix Use import syntax in your Rollup config and ensure your project uses ESM (type: module in package.json) or use a dynamic import.
deprecated The option `token` is deprecated since v1.0.3. Use `configFile` or inline `email`/`password`. ↓
fix Replace `token` with a config file or inline credentials.
gotcha If `sourcemap: true` in Rollup output, the plugin expects source map as a separate file. If not provided, upload will fail silently. ↓
fix Ensure both output file and .map file are present in the output directory, or set `sourcemap: false`.
gotcha The `branch` option set to `"auto"` relies on git branch name. If not in a git repo, it defaults to undefined, causing upload errors. ↓
fix Set a static branch name in config, or ensure your project is a git repository.
Install
npm install rollup-plugin-screeps-world yarn add rollup-plugin-screeps-world pnpm add rollup-plugin-screeps-world Imports
- default wrong
const screeps = require('rollup-plugin-screeps-world')correctimport screeps from 'rollup-plugin-screeps-world' - screepsWorld (named) wrong
import screepsWorld from 'rollup-plugin-screeps-world'correctimport { screepsWorld } from 'rollup-plugin-screeps-world' - ScreepsPluginOptions (type)
import type { ScreepsPluginOptions } from 'rollup-plugin-screeps-world'
Quickstart
import screeps from 'rollup-plugin-screeps-world';
import typescript from '@rollup/plugin-typescript';
export default {
input: 'src/main.ts',
output: {
dir: 'dist',
format: 'cjs',
entryFileNames: 'main.js',
sourcemap: true
},
plugins: [
typescript(),
screeps({
configFile: './screeps.json',
dryRun: false
})
]
};