jonschlinkert/pascalcase

Using with import in rollup file not working because of the type: "module"

AMontagu opened this issue · 4 comments

Trying to use this package in a rollup config file as:

import pascalcase from 'pascalcase';

But then this error happen:

[!] Error: While loading the Rollup configuration from "build/rollup.config.js", 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.
y-nk commented

same here. not sure how to handle that. anybody has a workaround in the meantime?

The code is really small. Even if not ideal just copy paste it in your project: https://github.com/jonschlinkert/pascalcase/blob/master/index.js

y-nk commented

@AMontagu indeed it can be almost a oneliner but still... i thought i could use this package. well 🤷

I thought too... But I think it's the best workaround or finding another package...