I ran into this problem while trying to upgrading from angular 6 to 8, whenever i try to ng serve or ng build i get the following error:
its been so fustrating, i’ve tried adding the “type”:”modules” to my package.json, trying renaming those files with the error to .cjs (then it doesnt even find the files because they are looking for the .js version)
i think the problem here is that the files with the error are inside node_modules?
i’ve tried deleting node_modules and doing NPM install but it was the same
require() of ES modules is not supported.
require() of W:sites****[email protected] from W:sites****CreditoConsumonode_modules@ngtoolswebpacksrcangular_compiler_plugin.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from W:sites****[email protected].```