Skip to content

[BUG] When compile in vite, throws error about use of eval is strongly discouraged as it poses security risks and may cause issues with minification #28

@ac-tech-madcoz

Description

@ac-tech-madcoz

🐛 Bug Report

Lib version: 4.4.0-protobi.5

Image

Steps To Reproduce

Just include the exceljs library in any React SPA application and build with exceljs in a single chunk:

vite build

The expected behaviour:

There should be no compilation errors when build in vite.

Possible solution (optional, but very helpful):

I have found a similar issue reported in another exceljs fork, the issue is located as below:
devextreme-exceljs-fork produces artifacts with eval

And the issue is related to "asn1.js", which describe as below:
Remove eval

I have also checked the complied code in "dist/exceljs.js":

...
Entity.prototype._createNamed = function createNamed(base) {
  var named;
  try {
    named = require('vm').runInThisContext('(function ' + this.name + '(entity) {\n' + '  this._initNamed(entity);\n' + '})');
  } catch (e) {
    named = function named(entity) {
      this._initNamed(entity);
    };
  }
  inherits(named, base);
  named.prototype._initNamed = function initnamed(entity) {
    base.call(this, entity);
  };
  return new named(this);
};
...

which matches the issue in "Remove eval" in "asn1.js", according to the changes in "devextreme-exceljs-fork" located as below:
Grids: devextreme-exceljs-fork produces artifacts with eval

Need to update the version of "asn1.js" from 4.10.1 to 5.4.1.

The dependencies chain is follows:
browserify (16.5.2) -> crypto-browserify (3.12.0) -> browserify-sign (4.2.5) -> parse-asn1 (5.1.9) -> asn1.js (4.10.1)

Metadata

Metadata

Labels

bugSomething isn't workingdependenciesPull requests that update a dependency file

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions