Skip to content

Modifying String.prototype.replaceAll globally is affecting regular expression behavior when importing the library. #28

@nacaceres

Description

@nacaceres

String.prototype.replaceAll = function (search, replacement) {

Errors like SyntaxError: Invalid regular expression: /*/g: Nothing to repeat have been reported in the app. Some regex patterns are not being applied correctly because the global replacement is affecting the entire execution. To fix this, we need to import the package dynamically:

const originalStringReplaceAll = String.prototype.replaceAll;
const tnefModule = await import('node-tnef');
String.prototype.replaceAll = originalStringReplaceAll;
const tnef = tnefModule.default || tnefModule;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions