Require() of ES Module not supported while updating from Angular 12 to 13
I have updated all my packages to support Angular 13, but still after complilation in the main.js
platform-browser gets imported by require which could possibly cause this issue
Error: require() of ES Module /node_modules/@angular/platform-browser/fesm2015/platform-browser.mjs not supported.
Instead change the require of /node_modules/@angular/platform-browser/fesm2015/platform-browser.mjs to a dynamic import() which is available in all CommonJS modules.
at __node_internal_captureLargerStackTrace (node:internal/errors:477:5)
at new NodeError (node:internal/errors:387:5)
at Module.load (node:internal/modules/cjs/loader:1009:11)
at Module._load (node:internal/modules/cjs/loader:846:12)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at o._load (node:electron/js2c/renderer_init:2:3109)
at Module.require (node:internal/modules/cjs/loader:1035:19)
at require (node:internal/modules/cjs/helpers:102:18)
at 7258 (main.js:1:1070126)
at r (runtime.js:1:127)
at R (main.js:1:2708253)
at main.js:1:2708270
at n (runtime.js:1:3008)
at main.js:1:57
Package.json
"dependencies": {
"@angular/animations": "~13.4.0",
"@angular/cdk": "^13.3.9",
"@angular/common": "13.4.0",
"@angular/core": "13.4.0",
"@angular/forms": "~13.4.0",
"@angular/material": "^13.3.9",
"@angular/platform-browser": "~13.4.0",
"@angular/platform-browser-dynamic": "~13.4.0",
"@angular/router": "~13.4.0",
"@grpc/grpc-js": "^1.2.12",
"angular-plotly.js": "^1.8.0",
"archiver": "^4.0.2",
"async-waterfall": "^0.1.5",
"blockly": "^5.20210325.0",
"bootstrap": "^4.5.2",
"chokidar": "^3.5.2",
"crypto-js": "^4.0.0",
"dom-to-image": "^2.6.0",
"downloads-folder": "^3.0.1",
"electron-json-storage": "^4.5.0",
"electron-log": "^4.4.1",
"exceljs": "^4.3.0",
"file-saver": "^2.0.2",
"form-data": "^4.0.0",
"google-protobuf": "^3.13.0",
"http-server": "^0.12.3",
"jquery": "^3.5.1",
"lodash": "^4.17.21",
"masonry-layout": "^4.2.2",
"moment": "^2.29.1",
"moment-timezone": "^0.5.32",
"ng-circle-progress": "^1.5.1",
"ng-click-outside": "^6.0.0",
"ngx-filter-pipe": "^2.1.2",
"plotly.js": "^2.9.0",
"resize-observer-polyfill": "^1.5.1",
"rxjs": "^6.5.3",
"rxjs-compat": "^6.6.3",
"split2": "^3.2.2",
"systeminformation": "^5.11.9",
"tslib": "^2.0.0",
"yargs": "^17.0.1",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^13.1.0",
"@angular-devkit/build-angular": "~13.0.2",
"@angular/cli": "~13.0.2",
"@angular/compiler": "~13.4.0",
"@angular/compiler-cli": "~13.4.0",
"@angular/language-service": "~13.4.0",
"@types/crypto-js": "^4.0.1",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/lodash": "^4.14.168",
"@types/node": "^14.14.37",
"codelyzer": "^6.0.0",
"electron": "^22.2.1",
"electron-builder": "^23.1.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.6.4",
"webpack": "^5.84.1",
"webpack-node-externals": "^2.5.2"
}