Skip to content

Problem deploying “feed” on Cloudflare, which uses sax-js #275

@Wolfr

Description

@Wolfr

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/sax/lib/sax.js b/node_modules/sax/lib/sax.js
index 122ad8e..ec41c06 100644
--- a/node_modules/sax/lib/sax.js
+++ b/node_modules/sax/lib/sax.js
@@ -237,7 +237,11 @@
       typeof Buffer.isBuffer === 'function' &&
       Buffer.isBuffer(data)) {
       if (!this._decoder) {
-        var SD = require('string_decoder').StringDecoder
+        var SD = class { 
+            constructor() { this.decoder = new TextDecoder("utf-8"); }
+            write(buffer) { return this.decoder.decode(buffer, { stream: true }); }
+            end(buffer) { return this.decoder.decode(buffer); }
+        };
         this._decoder = new SD('utf8')
       }
       data = this._decoder.write(data)

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions