MCPcopy
hub / github.com/rollup/rollup / logCannotLoadConfigAsCjs

Function logCannotLoadConfigAsCjs

src/utils/logs.ts:564–575  ·  view source on GitHub ↗
(originalError: Error)

Source from the content-addressed store, hash-verified

562}
563
564export function logCannotLoadConfigAsCjs(originalError: Error): RollupLog {
565 return tweakStackMessage(
566 {
567 cause: originalError,
568 code: INVALID_CONFIG_MODULE_FORMAT,
569 message: `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.\n\nOriginal error: ${originalError.message}`,
570 stack: originalError.stack,
571 url: getRollupUrl(URL_BUNDLE_CONFIG_AS_CJS)
572 },
573 originalError.message
574 );
575}
576
577export function logCannotLoadConfigAsEsm(originalError: Error): RollupLog {
578 return tweakStackMessage(

Callers 1

getConfigFileExportFunction · 0.90

Calls 2

getRollupUrlFunction · 0.90
tweakStackMessageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…