[BUG] ExcelJS 4.1.0 is not working with Angular 9 in IE11
See original GitHub issueđ Bug Report
Lib version: 4.1.0 angular: 9.0.7
I have used polyfill code for unicode but still its giving error âInvalid range in character setâ in polyfill.ts in IE11
unicode-regex-polyfill.js
import 'core-js/modules/es.promise';
import 'core-js/modules/es.object.assign';
import 'core-js/modules/es.object.keys';
import 'regenerator-runtime/runtime';
import rewritePattern from 'regexpu-core';
import { generateRegexpuOptions } from '@babel/helper-create-regexp-features-plugin/lib/util';
// const { RegExp } = global;
try {
new RegExp('a', 'u');
} catch (err) {
// @ts-ignore
global.RegExp = function(pattern, flags) {
if (flags && flags.includes('u')) {
return new RegExp(
rewritePattern(
pattern,
flags,
generateRegexpuOptions({ flags, pattern })
)
);
}
return new RegExp(pattern, flags);
};
// @ts-ignore
global.RegExp.prototype = RegExp;
}
polyfill.js
....
....
....
import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'unicode-regex-polyfill.js';
import 'exceljs';
....
....
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9
Top Results From Across the Web
Why ExcelJs plugin is not working in IE11? - Stack Overflow
I am using Angular 9 and excelJs 4.1.1, this is working fine in chrome but only in IE11 giving Error: Invalid range in...
Read more >How To Fix Your Angular App When It's Not Working in IE11
Sometimes, your application may throw errors in IE11, even when it is working fine in other browsers. There can be numerous reasons why...
Read more >Why Exceljs Plugin Is Not Working In Ie11 - ADocLib
I am using Angular 9 and excelJs 4.1.1 this is working fine in chrome but only in IE11 giving Error: Invalid range in...
Read more >exceljs - npm
Sometimes (really very often) workbook has worksheets with id not starting from 1. // For instance It happens when any worksheet has been ......
Read more >exceljs - npm.io
I have just one request; If you submit a pull request for a bugfix, please add a unit-test or integration-test (in the spec...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found that this polyfill worked however the last line needed to be changed to avoid breaking other libraries that might access the prototype of RegExp. Changing the line
window.RegExp.prototype = RegExp;
to the following fixed the issue and allowed me to use version 4.2.1 of ExcelJS:window.RegExp.prototype = RegExp.prototype;
I got this working using:
polyfill.ts
unicode-regex-polyfill.ts:
Replaced global with window, and adjusted some polyfill imports.
I added âimport âexceljs/dist/exceljsâ;â before the zone polyfill for angular, because zone complained about Promise being changed, and i remembered this as workaround from another issue.
Also i used âimport âexceljs/dist/exceljsâ;â instead of âimport âexceljsâ;â everywhere, not only in the polyfill.ts. I did NOT use âimport âexceljs/dist/es5â;â because that somehow got a lot of code in node_modules into the typescript compiler scope, and produced errors for missing fs module (which is fine on windows) and other stuff.
BUT: