Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,41 @@ const formatted = new NgBrDirectives.InscricaoEstadualPipe()
.transform('625085487072', 'sp');
```

## Troubleshooting

### `js-brasil` fails to compile / CommonJS warning in Angular 11+

Angular 11 introduced stricter handling of CommonJS dependencies. Because `js-brasil` ships
a CommonJS build, Angular may print a warning or fail with an error like:

```
WARNING in js-brasil (and its dependencies) should be converted to ES modules.
CommonJS or AMD dependencies can cause optimization bailouts.
```

**Fix:** add `js-brasil` to `allowedCommonJsDependencies` in your project's `angular.json`:

```json
{
"projects": {
"<your-app>": {
"architect": {
"build": {
"options": {
"allowedCommonJsDependencies": ["js-brasil"]
}
}
}
}
}
}
```

See the [Angular CommonJS dependencies guide](https://angular.io/guide/build#configuring-commonjs-dependencies)
for more details.

---

## Collaborate

```bash
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@angular/router": "^19.2.0",
"autoprefixer": "^10.2.3",
"core-js": "^3.6.4",
"js-brasil": "2.5.3",
"js-brasil": "2.7.1",
"postcss": "^8.2.4",
"rxjs": "^7.8.0",
"rxjs-compat": "^6.0.0",
Expand Down
Loading