ng add @angular/pwa cannot find AppModule if imported through index.ts #11499
Labels
area: @angular/pwa
freq1: low
Only reported by a handful of users who observe it rarely
severity3: broken
type: bug/fix
Milestone
Bug Report or Feature Request (mark with an
x
)Area
Versions
Repro steps
index.ts
in the App module folder with at least the following content:main.ts
, import the App module indirectly by using its parent folder:The log given by the failure
Desired functionality
Make PWA install work even when importing the AppModule indirectly (through an
index.ts
).To be more accurate, the
findBootstrapModulePath
function fromng-ast-utils.d.ts
should properly identify the AppModule path in this setup.angular-cli/packages/schematics/angular/utility/ng-ast-utils.ts
Line 49 in 44086c6
This method is called by
updateAppModule
fromangular-cli/packages/schematics/angular/service-worker/index.ts
Line 99 in 8ce5ef4
The failure occurs when trying to update the content of a file which does not exists. Checking the file exists and displaying a better message would also help.
Mention any other details that might be useful
The issue was encountered when attempting to add PWA to our NGXP Seed web side.
Since we managed to find out the root cause, the workaround of using the complete path will be used for now.
The text was updated successfully, but these errors were encountered: