(node:28248) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. (Use `node --trace-warnings ...` to show where the warning was created) [!] RollupError: Node tried to load your configuration file as CommonJS even though it is likely an ES module. To resolve this, change the extension of your configuration to ".mjs", set "type": "module" in your package.json file or pass the "--bundleConfigAsCjs" flag. Original error: Unexpected token 'export' https://rollupjs.org/command-line-interface/#bundleconfigascjs E:\my-screeps-bot\rollup.config.js:2 export default { ^^^^^^ SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1176:20) at Module._compile (node:internal/modules/cjs/loader:1218:27) at Module._extensions..js (node:internal/modules/cjs/loader:1308:10) at Module.load (node:internal/modules/cjs/loader:1117:32) at Module._load (node:internal/modules/cjs/loader:958:12) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29) at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
时间: 2024-04-24 17:21:16 浏览: 306
check-export-map:检查package.json中声明的导出映射是否有效
根据你提供的错误信息,看起来你的配置文件中使用了 ES 模块的语法,但是 Node.js 将其错误地当作了 CommonJS 模块来加载,导致出现了错误。
为了解决这个问题,你可以尝试以下几种方法之一:
1. 将你的配置文件的扩展名改为 ".mjs",这样 Node.js 将会将其视为 ES 模块。
2. 在你的 package.json 文件中添加 "type": "module" 字段,告诉 Node.js 这是一个 ES 模块。
请根据你的具体情况选择其中一种方法来解决问题。希望能帮到你!如果你有其他问题,可以继续问我。
阅读全文