Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-12734

[JS] Arrow v4.0.0 breaks Snowpack builds

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 4.0.0
    • None
    • JavaScript
    • None

    Description

      Snowpack builds break as of Apache Arrow v4.0.0, with the following error:

      ReferenceError: Cannot access 'Buffer' before initialization
      at eval (eval at <anonymous> (https://cdn.skypack.dev/-/apache-arrow@v4.0.0-R0opCrO48cH4DMah69zo/dist=es2020,mode=imports/optimized/apache-arrow.js:6:17), <anonymous>:1:1)
      at https://cdn.skypack.dev/-/apache-arrow@v4.0.0-R0opCrO48cH4DMah69zo/dist=es2020,mode=imports/optimized/apache-arrow.js:6:17

      I believe this also breaks other bundlers that use hot module replacement, such as Vite (https://github.com/vitejs/vite).

      This appears to be caused by the following line of exported code, which makes potentially problematic use of "eval":  

      const _Buffer = eval("typeof Buffer === 'function' ? Buffer : null");

      Note that Arrow version 3 works without incident. This error was reported by a user of the Arquero library (https://github.com/uwdata/arquero/issues/166) as it is breaking their build.

      To reproduce, load the following HTML:

       
      <!DOCTYPE html>
      <html lang="en">
        <body>
          <script type="module">
            import * as Arrow from "https://cdn.skypack.dev/apache-arrow@4.0.0";
            console.log(Arrow);
          </script>
        </body>
      </html>
       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jheer Jeffrey Heer
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: