You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] packages/d3fc/package.json => scripts => build is broken #1891
import babel from '@rollup/plugin-babel';
import nodeResolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import serve from 'rollup-plugin-serve';
import livereload from 'rollup-plugin-livereload';
const devMode = process.env.BUILD === 'dev';
let d3fcPkg = require('./package.json');
This isn't a bug — the build works as intended. A few clarifications:
Mixed ESM/CJS in rollup config: The require('./package.json') on line 9 is intentional. Rollup's config files support both ESM imports and CJS require() — this is a common pattern for loading JSON in config files that predate import ... assert { type: 'json' }. The ESM imports handle plugins, the CJS require handles the JSON read. Rollup processes the config file itself, so Node's module resolution rules don't apply here.
Rollup plugins not in packages/d3fc/package.json: This is a Lerna monorepo. Dev dependencies like rollup plugins are hoisted to the root package.json, where they're all present (@rollup/plugin-babel, @rollup/plugin-node-resolve, @rollup/plugin-terser, rollup-plugin-serve, rollup-plugin-livereload). Individual package package.json files only list their runtime dependencies.
No "type": "module" needed: Rollup handles its own config file module format independently of the package's type field. Adding it would actually risk breaking the require() call and other CJS assumptions in the build tooling.
npm ci && npm run bundle && npm run bundle-min && npm test all pass cleanly on Node 20.15.0 (the version pinned in CI).
Activity
defnotjec commentedon Apr 15, 2026
This isn't a bug — the build works as intended. A few clarifications:
Mixed ESM/CJS in rollup config: The
require('./package.json')on line 9 is intentional. Rollup's config files support both ESM imports and CJSrequire()— this is a common pattern for loading JSON in config files that predateimport ... assert { type: 'json' }. The ESM imports handle plugins, the CJS require handles the JSON read. Rollup processes the config file itself, so Node's module resolution rules don't apply here.Rollup plugins not in
packages/d3fc/package.json: This is a Lerna monorepo. Dev dependencies like rollup plugins are hoisted to the rootpackage.json, where they're all present (@rollup/plugin-babel,@rollup/plugin-node-resolve,@rollup/plugin-terser,rollup-plugin-serve,rollup-plugin-livereload). Individual packagepackage.jsonfiles only list their runtime dependencies.No
"type": "module"needed: Rollup handles its own config file module format independently of the package'stypefield. Adding it would actually risk breaking therequire()call and other CJS assumptions in the build tooling.npm ci && npm run bundle && npm run bundle-min && npm testall pass cleanly on Node 20.15.0 (the version pinned in CI).