Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
126
rated 0 times [  131] [ 5]  / answers: 1 / hits: 10410  / 2 Years ago, fri, october 14, 2022, 12:00:00

  1. i want to install rollup-plugin-visualizer but its need to update rollup.



  2. 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.


  3. 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/[email protected]
npm ERR! Found: [email protected]
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 [email protected]
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 !!!



💡 This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.


  1. i have delete 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?


More From » package

 Answers
4

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


[#24] Tuesday, July 26, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
melindab

Total Points: 511
Total Questions: 109
Total Answers: 106

Location: San Marino
Member since Thu, Jun 25, 2020
4 Years ago
;