I used to run ng build
to produce a build for my Angular 18 application. It always worked fine, generating an index.html
file. However, today it suddenly started generating an index.csr.html
file instead, and I can't figure out why.
I use Firebase Hosting and a GitHub Action to automatically deploy the build. Since it is not generating an index.html
, the deployment fails. Everything was running fine until yesterday.
To work around this issue, I have to manually rename index.csr.html
to index.html
, and then the deployment works fine.
Following is the output to the ng build
command.
Application bundle generation complete. [15.184 seconds]
▲ [WARNING] Module 'undici' used by 'node_modules/@firebase/auth-compat/dist/esm/index.node.esm.js' is not ESM
CommonJS or AMD dependencies can cause optimization bailouts.
For more information see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies
▲ [WARNING] Module 'undici' used by 'node_modules/@firebase/auth/dist/node-esm/internal.js' is not ESM
CommonJS or AMD dependencies can cause optimization bailouts.
For more information see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies
▲ [WARNING] Module 'faye-websocket' used by 'node_modules/@firebase/database/dist/node-esm/index.node.esm.js' is not ESM
CommonJS or AMD dependencies can cause optimization bailouts.
For more information see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies
I encountered a similar problem. I realized that to generate a simple index.html
you need to turn off the SSR. I changed two fields in angular.json
"prerender": false,
"ssr": false