You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Jeffrey Heer (Jira)" <ji...@apache.org> on 2021/05/11 07:14:00 UTC

[jira] [Created] (ARROW-12734) [JS] Arrow v4.0.0 breaks Snowpack builds

Jeffrey Heer created ARROW-12734:
------------------------------------

             Summary: [JS] Arrow v4.0.0 breaks Snowpack builds
                 Key: ARROW-12734
                 URL: https://issues.apache.org/jira/browse/ARROW-12734
             Project: Apache Arrow
          Issue Type: Bug
          Components: JavaScript
    Affects Versions: 4.0.0
            Reporter: Jeffrey Heer


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>}}
  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)