The NGX-PFE library is safe to run as a Angular SSR (Server-Side Rendering) application or prerendering context. However, one additional build configuration step is required in consuming applications that enable SSR, this page documents that step.
This guide assumes your app already has Angular SSR set up, e.g. via:
Example :ng add @angular/ssror, in an Nx workspace:
Example :nx g @nx/angular:setup-ssr --project=<your-app>If your app does SSR or prerendering, you must mark jsonpath and esprima as external dependencies in your server build target.
If you're using the webpack-based @angular-devkit/build-angular:server builder (project.json in an Nx workspace, or angular.json in a plain Angular CLI project), add this to the server target's options:
{
"server": {
"executor": "@angular-devkit/build-angular:server",
"options": {
"externalDependencies": ["jsonpath", "esprima"]
}
}
}If you're using the newer application builder, there's no separate server target. Add externalDependencies to the build target's options directly:
{
"build": {
"executor": "@angular-devkit/build-angular:application",
"options": {
"externalDependencies": ["jsonpath", "esprima"]
}
}
}⚠️ IMPORTANT: Without this setting, the app will fail at runtime with an error similar to
Error: EBADF: bad file descriptor, fstat.