Skip to content

Rollup cant parse plugin that dependend on ES package #4619

@ColdSpirit0

Description

@ColdSpirit0

Rollup Version

v2.77.2

Operating System (or Browser)

Windows 10

Node Version (if applicable)

v17.2.0

Link To Reproduction

https://github.com/ColdSpirit0/rollup-config-problem

Expected Behaviour

Plugin working

Actual Behaviour

Throws error:

[!] Error: While loading the Rollup configuration from "rollup.config.ts", Node tried to require an ES module from a CommonJS 
file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can 
try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will prevent 
Rollup from trying to preprocess the file but rather hand it to Node directly.
https://rollupjs.org/guide/en/#using-untranspiled-config-files
    at Object.error (D:\Work\js\rollup-config-problem\node_modules\rollup\dist\shared\rollup.js:198:30)     
    at loadConfigFromBundledFile (D:\Work\js\rollup-config-problem\node_modules\rollup\dist\shared\loadConfigFile.js:637:27)
    at getDefaultFromTranspiledConfigFile (D:\Work\js\rollup-config-problem\node_modules\rollup\dist\shared\loadConfigFile.js:613:12)
    at loadConfigFile (D:\Work\js\rollup-config-problem\node_modules\rollup\dist\shared\loadConfigFile.js:572:11)
    at Object.loadAndParseConfigFile (D:\Work\js\rollup-config-problem\node_modules\rollup\dist\shared\loadConfigFile.js:552:21)
    at getConfigs (D:\Work\js\rollup-config-problem\node_modules\rollup\dist\bin\rollup:1691:39)
    at runRollup (D:\Work\js\rollup-config-problem\node_modules\rollup\dist\bin\rollup:1665:43)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions