Before #41162, angular.io was broken on IE 11 due to missing a polyfill for an API (`Reflect.construct()`) needed by the Custom Elements ES5 shim. #41162 tried to fix this by loading the necessary polyfill (`es.reflect.construct.js`) on browsers that do not support ES2015 modules (including IE 11). It turns out that the fix in #41162 was itself broken, because the `es.reflect.consruct.js` script (included directly in the page via a `<script>` tag) was in CommonJS format (which cannot run in the browser as is). By chance, this still allowed browsers that supported neither Custom Elements nor ES2015 modules (such as IE 11) to work correctly as a side-effect of loading the `@webcomponents/custom-elements` polyfill after the Custom Elements ES5 shim (`native-shim.js`). However, on the few browsers that natively support Custom Elements but not ES2015 modules, angular.io would still be broken. This commit correctly fixes angular.io on all browsers by properly bundling the polyfills and transpiling to ES5. Implementation-wise, we use [esbuild][1] for bundling the polyfills (and converting from CommonJS to a browser-compatible, IIFE-based format) and [swc][2] for downleveling the code to ES5 (since `esbuild` only supports ES2015+). [1]: https://esbuild.github.io/ [2]: https://swc.rs/ PR Close #41183
188 lines
5.2 KiB
JSON
188 lines
5.2 KiB
JSON
{
|
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
"version": 1,
|
|
"cli": {
|
|
"packageManager": "yarn",
|
|
"warnings": {
|
|
"typescriptMismatch": false
|
|
},
|
|
"analytics": false
|
|
},
|
|
"newProjectRoot": "projects",
|
|
"projects": {
|
|
"site": {
|
|
"root": "",
|
|
"sourceRoot": "src",
|
|
"projectType": "application",
|
|
"prefix": "aio",
|
|
"schematics": {
|
|
"@schematics/angular:component": {
|
|
"inlineStyle": true,
|
|
"style": "scss"
|
|
}
|
|
},
|
|
"architect": {
|
|
"build": {
|
|
"builder": "@angular-devkit/build-angular:browser",
|
|
"options": {
|
|
"outputPath": "dist",
|
|
"index": "src/index.html",
|
|
"main": "src/main.ts",
|
|
"polyfills": "src/polyfills.ts",
|
|
"tsConfig": "tsconfig.app.json",
|
|
"webWorkerTsConfig": "tsconfig.worker.json",
|
|
"aot": true,
|
|
"optimization": true,
|
|
"buildOptimizer": true,
|
|
"outputHashing": "all",
|
|
"sourceMap": true,
|
|
"statsJson": true,
|
|
"extractLicenses": true,
|
|
"namedChunks": true,
|
|
"vendorChunk": false,
|
|
"assets": [
|
|
"src/assets",
|
|
"src/generated",
|
|
"src/pwa-manifest.json",
|
|
"src/google385281288605d160.html"
|
|
],
|
|
"styles": [
|
|
"src/styles/main.scss"
|
|
],
|
|
"scripts": [],
|
|
"budgets": [
|
|
{
|
|
"type": "anyComponentStyle",
|
|
"maximumWarning": "6kb"
|
|
}
|
|
]
|
|
},
|
|
"configurations": {
|
|
"fast": {
|
|
"optimization": false
|
|
},
|
|
"next": {
|
|
"fileReplacements": [
|
|
{
|
|
"replace": "src/environments/environment.ts",
|
|
"with": "src/environments/environment.next.ts"
|
|
}
|
|
],
|
|
"serviceWorker": true
|
|
},
|
|
"rc": {
|
|
"fileReplacements": [
|
|
{
|
|
"replace": "src/environments/environment.ts",
|
|
"with": "src/environments/environment.rc.ts"
|
|
}
|
|
],
|
|
"serviceWorker": true
|
|
},
|
|
"stable": {
|
|
"fileReplacements": [
|
|
{
|
|
"replace": "src/environments/environment.ts",
|
|
"with": "src/environments/environment.stable.ts"
|
|
}
|
|
],
|
|
"serviceWorker": true
|
|
},
|
|
"archive": {
|
|
"fileReplacements": [
|
|
{
|
|
"replace": "src/environments/environment.ts",
|
|
"with": "src/environments/environment.archive.ts"
|
|
}
|
|
],
|
|
"serviceWorker": true
|
|
},
|
|
"ci": {
|
|
"progress": false
|
|
}
|
|
}
|
|
},
|
|
"serve": {
|
|
"builder": "@angular-devkit/build-angular:dev-server",
|
|
"options": {
|
|
"browserTarget": "site:build"
|
|
},
|
|
"configurations": {
|
|
"fast": {
|
|
"browserTarget": "site:build:fast"
|
|
},
|
|
"next": {
|
|
"browserTarget": "site:build:next"
|
|
},
|
|
"rc": {
|
|
"browserTarget": "site:build:rc"
|
|
},
|
|
"stable": {
|
|
"browserTarget": "site:build:stable"
|
|
},
|
|
"archive": {
|
|
"browserTarget": "site:build:archive"
|
|
},
|
|
"ci": {
|
|
"browserTarget": "site:build:ci"
|
|
}
|
|
}
|
|
},
|
|
"extract-i18n": {
|
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
|
"options": {
|
|
"browserTarget": "site:build"
|
|
}
|
|
},
|
|
"test": {
|
|
"builder": "@angular-devkit/build-angular:karma",
|
|
"options": {
|
|
"main": "src/test.ts",
|
|
"polyfills": "src/polyfills.ts",
|
|
"tsConfig": "tsconfig.spec.json",
|
|
"webWorkerTsConfig": "tsconfig.worker.json",
|
|
"karmaConfig": "karma.conf.js",
|
|
"assets": [
|
|
"src/assets",
|
|
"src/generated",
|
|
"src/pwa-manifest.json",
|
|
"src/google385281288605d160.html"
|
|
],
|
|
"styles": [
|
|
"src/styles/main.scss"
|
|
],
|
|
"scripts": []
|
|
}
|
|
},
|
|
"lint": {
|
|
"builder": "@angular-devkit/build-angular:tslint",
|
|
"options": {
|
|
"tsConfig": [
|
|
"tsconfig.app.json",
|
|
"tsconfig.spec.json",
|
|
"tsconfig.worker.json",
|
|
"tests/e2e/tsconfig.json"
|
|
],
|
|
"exclude": [
|
|
"**/node_modules/**"
|
|
]
|
|
}
|
|
},
|
|
"e2e": {
|
|
"builder": "@angular-devkit/build-angular:protractor",
|
|
"options": {
|
|
"protractorConfig": "tests/e2e/protractor.conf.js",
|
|
"devServerTarget": "site:serve"
|
|
},
|
|
"configurations": {
|
|
"ci": {
|
|
"devServerTarget": "site:serve:ci"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"defaultProject": "site"
|
|
}
|