-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(angular): Use Angular compiler to compile @sentry/angular (#4641)
* switch from tsc to the Angular compiler to compile our Angular SDK. This is done via the Angular CLI which internally uses ngc and ng-packagr to build and package our SDK correctly so that the Angular runtime can process all SDK components (including TraceDirective) correctly. * important: This is a breaking change as it requires SDK users to use Angular >= 10. Currently, our SDK might support earlier Angular versions despite the fact that we only list Angular 10-13 as peer dependencies of the SDK. With this new compiler, applications using the Sentry Angular SDK on earlier versions than Angular 10 will not be able to compile correctly. * change some yarn scripts by making the Angular compiler the default builder
- Loading branch information
1 parent
8e31d21
commit 0ca9873
Showing
9 changed files
with
2,891 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* To learn more about this file see: https://angular.io/guide/workspace-config */ | ||
{ | ||
"$schema": "../../node_modules/@angular/cli/lib/config/schema.json", | ||
"version": 1, // version of angular.json | ||
"projects": { | ||
"sentry-angular": { | ||
"projectType": "library", | ||
"root": ".", | ||
"sourceRoot": "src", | ||
"architect": { | ||
"build": { | ||
"builder": "@angular-devkit/build-angular:ng-packagr", | ||
"options": { | ||
"tsConfig": "tsconfig.ngc.json", | ||
"project": "ng-package.json" | ||
}, | ||
"configurations": { | ||
"production": { | ||
"tsConfig": "tsconfig.ngc.json" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"defaultProject": "sentry-angular" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"$schema": "node_modules/ng-packagr/ng-package.schema.json", | ||
"dest": "build", | ||
"lib": { | ||
"entryFile": "src/index.ts", | ||
"umdModuleIds": { | ||
"@sentry/browser": "Sentry", | ||
"@sentry/utils": "Sentry.util" | ||
} | ||
}, | ||
"whitelistedNonPeerDependencies": ["@sentry/browser", "@sentry/utils", "@sentry/types", "tslib"], | ||
"assets": ["README.md", "LICENSE"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* To learn more about this file see: https://angular.io/config/tsconfig. */ | ||
// This tsconfig is used when building @sentry/angular with the Angular | ||
// compiler and `ng-packagr`. It configures a production build conforming | ||
// to the Angular Package Format (APF). | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"target": "es2015", | ||
"lib": ["dom", "es2015"], | ||
"baseUrl": "./" | ||
}, | ||
"angularCompilerOptions": { | ||
"skipTemplateCodegen": true, | ||
"strictMetadataEmit": true, | ||
"enableResourceInlining": true, | ||
"strictInjectionParameters": true, | ||
"strictInputAccessModifiers": true, | ||
"strictTemplates": true, | ||
// As per Angular 10, the recommendation from the library creation guide | ||
// is to disable compilation for the Ivy rendering engine in production builds | ||
// to ensure compatibility with Angular 10. | ||
// For Angular 11-13 applications, ngcc and the Angular linker convert the compiled JS | ||
// at application compile time into an Ivy-compatible version which is then further used in | ||
// the build process. This ensures compatibility with newer Angular versions than the one | ||
// that was used to initially compile the library (Angular 10 in our case). | ||
"enableIvy": false | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.