rollup-plugin-screeps
raw JSON → 1.0.1 verified Mon Apr 27 auth: no javascript
Rollup plugin for uploading compiled code to the Screeps MMO/private servers. Integrates directly into the Rollup build pipeline, reading credentials and server configuration from a screeps.json file. Supports automatic branch naming based on git branch, maps source files to screeps modules, and optionally uploads source maps. Current version 1.0.1 is stable with low release cadence. Alternative to grunt-screeps for projects using Rollup as bundler.
Common errors
error Error: Cannot find module 'rollup-plugin-screeps' ↓
cause Package not installed or installed globally but not in local node_modules.
fix
Run npm install --save-dev rollup-plugin-screeps in the project directory.
error TypeError: screeps is not a function ↓
cause Using require() with ESM-only package.
fix
Change to import screeps from 'rollup-plugin-screeps' and ensure rollup.config.js uses .mjs extension or nearest package.json has "type": "module".
error Error: Config file not found at ./screeps.json ↓
cause The configFile path is incorrect or the file does not exist.
fix
Double-check the path relative to where rollup is invoked. Use absolute path or ensure screeps.json is in the same directory as rollup.config.js.
Warnings
gotcha Plugin will fail silently if configFile path is wrong or screeps.json is malformed. ↓
fix Verify the configFile path is relative to the rollup config and the JSON is valid with all required fields: email, password, protocol, hostname, port, path, branch.
breaking Version 1.0.0 dropped support for CommonJS. The package is now ESM-only. ↓
fix Use import syntax instead of require(). Update your rollup config to ESM.
deprecated Using require() will throw a runtime error in Node.js without ESM support. ↓
fix Switch to dynamic import() or use a CommonJS wrapper like import().default.
gotcha If sourcemap is not true in rollup output, the plugin will not generate or upload source maps even if configured. ↓
fix Set sourcemap: true in the output configuration of rollup.config.js.
gotcha Setting branch to 'auto' depends on git being installed and available in the build environment; otherwise fails. ↓
fix Explicitly set branch string in screeps.json if git is not guaranteed available.
Install
npm install rollup-plugin-screeps yarn add rollup-plugin-screeps pnpm add rollup-plugin-screeps Imports
- default wrong
const screeps = require('rollup-plugin-screeps')correctimport screeps from 'rollup-plugin-screeps' - screeps wrong
import { rollupPluginScreeps } from 'rollup-plugin-screeps'correctimport { screeps } from 'rollup-plugin-screeps' - ScreepsPluginOptions
import type { ScreepsPluginOptions } from 'rollup-plugin-screeps'
Quickstart
// rollup.config.js
import screeps from 'rollup-plugin-screeps';
export default {
input: 'src/main.js',
output: {
dir: 'dist',
format: 'esm',
sourcemap: true
},
plugins: [
screeps({
configFile: './screeps.json',
dryRun: false
})
]
};