During the process of upgrading from Angular 6 to 8, I encountered a frustrating issue. Every time I attempt to run 'ng serve' or 'ng build', I encounter the following error:
I have tried various solutions such as adding "type":"modules" to my package.json file and renaming files with the error to .cjs, but no luck. It seems like the problematic files are located inside the node_modules directory.
Even after deleting the node_modules folder and reinstalling with NPM, the issue persists.
An unhandled exception occurred: Must use import to load ES Module: W:\sites\sacr-indx\CreditoConsumo\node_modules\@angular\compiler-cli\bundles\index.js
require() of ES modules is not supported.
...
It appears that the root of the problem lies within the angular_compiler_plugin:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AngularCompilerPlugin = void 0;
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
...