diff --git a/package.json b/package.json index f6837da92..a2d9f92ef 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "screeps-typescript-starter", + "type": "module", "version": "3.0.0", "description": "", "main": "index.js", diff --git a/rollup.config.js b/rollup.config.js index 70da24d20..b93b61a62 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -10,8 +10,12 @@ let cfg; const dest = process.env.DEST; if (!dest) { console.log("No destination specified - code will be compiled but not uploaded"); -} else if ((cfg = require("./screeps.json")[dest]) == null) { - throw new Error("Invalid upload destination"); +} else { + const screepsData = await import( "./screeps.json", { with: { type: "json" } } ); + cfg = screepsData.default[dest]; + if (cfg == null) { + throw new Error("Invalid upload destination"); + } } export default {