我的汇总项目就是这样...
// rollup.config.js
import pkg from "./package.json";
import {getRollupServerConfig} from "@jrg/build/dist/index.cjs";
const config = getRollupServerConfig(pkg);
export { config as default };
但是当我尝试使其成为mjs
// main: @jrg/build/dist/index.mjs
import {getRollupServerConfig} from "@jrg/build";
由于...而失败
(function (exports, require, module, __filename, __dirname) { import resolve from 'rollup-plugin-node-resolve'; ^^^^^^^
SyntaxError:意外的标识符
我认为这是因为汇总期望CJS。有可能吗?
答案 0 :(得分:0)
您绝对可以这样做......
// package.json
...
"scripts":{
"build":"node --experimental-json-modules ./node_modules/.bin/rollup --config rollup.config.mjs"
},