i want to install rollup-plugin-visualizer
but its need to update rollup.
updated rollup from 1.8.0
to 3.1.0
got error
[!] RollupError: 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.
delete node-modules folder and package-lock.json and install again npm i
got error
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @bet-core/ui@2.4.0
npm ERR! Found: rollup@3.1.0
npm ERR! node_modules/rollup
npm ERR! dev rollup@"^3.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer rollup@">=0.60.0 <3" from rollup-plugin-babel@4.4.0
npm ERR! node_modules/rollup-plugin-babel
npm ERR! dev rollup-plugin-babel@"^4.3.2" from the root project
rollup-plugin-babel
npm page says !!!
rollup-plugin-babel
then install @rollup/plugin-babel.
now i got this error[!] RollupError: 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.
Original error: Cannot use import statement outside a module
can someone tell me where to look for this error solutions?
i have find the solution.
At first changed format from 'esm'
to 'cjs'
in rollup.config.js
export default {
...
output: [
{
format: 'cjs',
...
},
]
};
then rollup.config.js
changed to rollup.config.mjs