Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Livereload fails with error require() of ES modules is not supported

Offen
#4,795 15 Kommentare 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
28/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
angular, nodejs, typescript
Bereich
build-system, cli

Rechercherichtung

Beginne damit, das Problem mit einer auf Angular 13 aktualisierten Ionic 6 Cordova-App zu reproduzieren. Führe anschließend ionic cordova run android --livereload aus und untersuche den gemeldeten Ladepfad von Angular compiler-cli und build-angular. Als erledigt gilt die Aufgabe, wenn Live Reload unter den aufgeführten Node- und Angular-Versionen ohne den ES-Modul-require()-Fehler startet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

triage

Steps to Reproduce:

  • Create New Ionic 6 Hello World App (Cordova)
  • Update to Angular 13 deps.
  • Run ionic cordova run android --livereload

Description:
When running with LIVERELOAD arg, gets this error immediately.

ng.cmd run app:ionic-cordova-serve --host=localhost --port=8100 --platform=android --consolelogs --consolelogs-port=53703
[ng] An unhandled exception occurred: Must use import to load ES Module: D:...\node_modules@angular\compiler-cli\bundles\index.js
[ng] require() of ES modules is not supported.
[ng] require() of D:...\node_modules@angular\compiler-cli\bundles\index.js from D:...\node_modules@ionic\angular-toolkit\node_modules@angular-devkit\build-angular\src\webpack\configs\common.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.
[ng] Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:...\node_modules@angular\compiler-cli\package.json.

My ionic info:

Ionic:

   Ionic CLI                     : 6.18.1 (C:\Users\steve\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.0.1
   @angular-devkit/build-angular : 13.1.2
   @angular-devkit/schematics    : 13.1.2
   @angular/cli                  : 13.1.2
   @ionic/angular-toolkit        : 5.0.3

Cordova:

   Cordova CLI       : 11.0.0
   Cordova Platforms : android 10.1.1, browser 6.0.0, ios 6.2.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, cordova-plugin-ionic 5.5.1, (and 12 other plugins)

Utility:

   cordova-res : 0.15.4
   native-run  : 1.5.0

System:

   Android SDK Tools : 26.1.1 (C:\Users\steve\AppData\Local\Android\Sdk)
   NodeJS            : v14.18.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.14.15
   OS                : Windows 10
Vorherrschende Sprache
TypeScript
Sterne
2k
Forks
681
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ionic-team/ionic-cli

Alle Issues in ionic-team/ionic-cli

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.