Merge pull request #4928 from GabrielInTheWorld/fixIE

Adds compiling to ES5 for IE11
This commit is contained in:
Emanuel Schütze 2019-08-22 15:00:15 +02:00 committed by GitHub
commit 1900ecb1ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 70 additions and 26 deletions

View File

@ -26,9 +26,21 @@
"assets": [
"src/assets",
"src/manifest.json",
{ "glob": "**/*", "input": "node_modules/tinymce/skins", "output": "/tinymce/skins/" },
{ "glob": "**/*", "input": "node_modules/tinymce/themes", "output": "/tinymce/themes/" },
{ "glob": "**/*", "input": "node_modules/tinymce/plugins", "output": "/tinymce/plugins/" }
{
"glob": "**/*",
"input": "node_modules/tinymce/skins",
"output": "/tinymce/skins/"
},
{
"glob": "**/*",
"input": "node_modules/tinymce/themes",
"output": "/tinymce/themes/"
},
{
"glob": "**/*",
"input": "node_modules/tinymce/plugins",
"output": "/tinymce/plugins/"
}
],
"styles": ["src/styles.scss"],
"scripts": ["node_modules/tinymce/tinymce.min.js"],
@ -36,12 +48,10 @@
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
@ -52,13 +62,14 @@
"vendorChunk": false,
"buildOptimizer": true,
"serviceWorker": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "5mb",
"maximumError": "10mb"
}
]
"budgets": [{
"type": "initial",
"maximumWarning": "5mb",
"maximumError": "10mb"
}]
},
"es5": {
"tsConfig": "./tsconfig-es5.app.json"
}
}
},
@ -70,6 +81,9 @@
"configurations": {
"production": {
"browserTarget": "client:build:production"
},
"es5": {
"browserTarget": "client:build:es5"
}
}
},
@ -91,9 +105,21 @@
"assets": [
"src/assets",
"src/manifest.json",
{ "glob": "**/*", "input": "node_modules/tinymce/skins", "output": "/tinymce/skins/" },
{ "glob": "**/*", "input": "node_modules/tinymce/themes", "output": "/tinymce/themes/" },
{ "glob": "**/*", "input": "node_modules/tinymce/plugins", "output": "/tinymce/plugins/" }
{
"glob": "**/*",
"input": "node_modules/tinymce/skins",
"output": "/tinymce/skins/"
},
{
"glob": "**/*",
"input": "node_modules/tinymce/themes",
"output": "/tinymce/themes/"
},
{
"glob": "**/*",
"input": "node_modules/tinymce/plugins",
"output": "/tinymce/plugins/"
}
]
}
},

View File

@ -12,6 +12,7 @@
"ng": "ng",
"ng-high-memory": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng",
"start": "ng serve --proxy-config proxy.conf.json --host=0.0.0.0",
"start-es5": "ng serve --proxy-config proxy.conf.json --host=0.0.0.0 --configuration es5",
"build": "npm run ng-high-memory -- build --prod",
"test": "ng test",
"lint-check": "ng lint",

View File

@ -457,7 +457,8 @@ export class PdfDocumentService {
const vfs = await this.initVfs();
await this.loadAllImages(vfs);
if (typeof Worker !== 'undefined') {
const isIE = /msie\s|trident\//i.test(window.navigator.userAgent);
if (typeof Worker !== 'undefined' && !isIE) {
const worker = new Worker('./pdf-worker.worker', {
type: 'module'
});
@ -485,7 +486,7 @@ export class PdfDocumentService {
});
} else {
this.matSnackBar.dismiss();
this.matSnackBar.open(this.translate.instant('Web workers are not supported on your browser.'), '', {
this.matSnackBar.open(this.translate.instant('Cannot create PDF files on this browser.'), '', {
duration: 0
});
}

View File

@ -15,11 +15,21 @@
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
* BROWSER POLYFILLS
*/
import 'core-js/es7/object';
import 'core-js/es7/array';
import 'core-js/es6/object';
import 'core-js/es6/array';
// forEach fix for IE11
if ('NodeList' in window && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = function(callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
/* IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
@ -36,7 +46,7 @@ import 'core-js/es7/reflect';
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents

View File

@ -0,0 +1,6 @@
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"target": "es5"
}
}