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": [
{
"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": [
{
"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`.

View File

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