pascalcase icon indicating copy to clipboard operation
pascalcase copied to clipboard

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

Open AMontagu opened this issue 3 years ago • 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.

AMontagu avatar Jul 25 '22 17:07 AMontagu

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

y-nk avatar Apr 16 '24 00:04 y-nk

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

AMontagu avatar Apr 16 '24 08:04 AMontagu

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

y-nk avatar Apr 19 '24 04:04 y-nk

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

AMontagu avatar Apr 19 '24 08:04 AMontagu