rtf-stream-parser npm : Super expression must either be null or a function error with...

Discussão em 'Angular' iniciado por Veela, Novembro 13, 2024.

  1. Veela

    Veela Guest

    I'm facing an issue with the DeEncapsulate class from the rtf-stream-parser library in my Angular application. I'm getting the following error:

    **polyfills.js:5887 Uncaught TypeError: Super expression must either be null or a function
    at _inherits (polyfills.js:5887:11)
    at vendor.js:71541:3
    at 1Z4d (vendor.js:71970:2)**

    vendor.js:
    var DeEncapsulate = /*#__PURE__*/function (_stream_1$Transform) {
    _inherits(DeEncapsulate, _stream_1$Transform);

    //component
    import * as iconvLite from 'iconv-lite';
    import { deEncapsulateSync } from 'rtf-stream-parser';

    const rtf = '{\\rtf1\\ansi\\ansicpg1252\\fromtext{{{{{{hello}}}}}}}';
    const result = deEncapsulateSync(rtf, { decode: iconvLite.decode });
    console.log(result); // { mode: 'text', text: 'hello' }


    i have installed in my project:

    • npm i stream-browserify
    • npm i process
    • npm i buffer
    • npm i rtf-stream-parser
    • npm i iconv-lite
    • npm i stream

    and included in polyfill.ts

    (window as any).global = window;
    import { Buffer } from 'buffer';
    import * as process from 'process';
    import * as stream from 'stream-browserify';

    (window as any).Buffer = Buffer;
    (window as any).process = process;
    (window as any).stream = stream;

    Continue reading...

Compartilhe esta Página