Skip to content

Commit 6ada484

Browse files
committed
nginx issue documented
1 parent 931e8ac commit 6ada484

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

docs-website/docs/getting-started.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,20 @@ export class AppComponent {
114114
2. **Reinstall dependencies**: `npm install`
115115
3. **Check Angular version**: Ensure compatibility
116116

117+
### Production Issues?
118+
119+
**PDF viewer stuck at loading screen in production (nginx)**
120+
121+
This is caused by incorrect MIME types for `.mjs` files. Add to your nginx configuration:
122+
123+
```nginx
124+
types {
125+
application/javascript js mjs;
126+
}
127+
```
128+
129+
**Why**: PDF.js v5+ uses ES modules (`.mjs` files) that need proper MIME type configuration.
130+
117131
## What's Next?
118132

119133
- 🎨 [**Features Overview**](./features/overview) - Explore all available features

docs-website/docs/installation.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ [email protected] /path/to/your-app
2424
2525
```
2626

27+
## Production Deployment
28+
29+
### Nginx Configuration
30+
31+
For production deployments using nginx, you may need to configure MIME types for PDF.js ES modules (`.mjs` files):
32+
33+
```nginx
34+
# Add to your nginx.conf or site configuration
35+
types {
36+
application/javascript js mjs;
37+
}
38+
```
39+
40+
**Why this is needed**: PDF.js v5+ uses `.mjs` files (ES modules). Without proper MIME type configuration, nginx serves these files with incorrect content-type headers, causing the PDF viewer to crash during loading in production environments.
41+
42+
**Symptoms**: Everything works locally but the viewer gets stuck at the loading screen in production.
43+
2744
## Angular Version Compatibility
2845

2946
| Angular Version | Support Level | Notes |

lib/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,21 @@ Add PDF.js assets to your `angular.json`:
215215
- **Node.js**: 18.0+
216216
- **TypeScript**: 5.0+
217217

218+
### Production Deployment
219+
220+
#### Nginx Configuration
221+
222+
For production deployments using nginx, you may need to configure MIME types for PDF.js ES modules (`.mjs` files):
223+
224+
```nginx
225+
# Add to your nginx.conf or site configuration
226+
types {
227+
application/javascript js mjs;
228+
}
229+
```
230+
231+
**Why this is needed**: PDF.js v5+ uses `.mjs` files (ES modules). Without proper MIME type configuration, nginx serves these files with incorrect content-type headers, causing the PDF viewer to crash during loading in production environments.
232+
218233
### Angular Version Support
219234

220235
| Angular Version | Support Level | Notes |
@@ -498,6 +513,7 @@ export class MyComponent {
498513
| `borderRadius` | `string` | - | Border radius |
499514
| `customCSS` | `string` | - | Custom CSS styles |
500515
| `cspNonce` | `string` | - | CSP nonce for customCSS (optional) |
516+
| `iframeTitle` | `string` | - | Accessible title for iframe (optional) |
501517
| `showSpinner` | `boolean` | `true` | Show loading spinner |
502518
| `customSpinnerTpl` | `TemplateRef` | - | Custom spinner template |
503519
| `spinnerClass` | `string` | - | Custom spinner CSS class |

0 commit comments

Comments
 (0)