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/09/20 16:52:00 UTC

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

    [ https://issues.apache.org/jira/browse/ARROW-12734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17417723#comment-17417723 ] 

Jeffrey Heer commented on ARROW-12734:
--------------------------------------

Unfortunately, Snowpack builds are still broken as of Apache Arrow v5. If I update my HTML snippet above to use 5.0.0 instead of 4.0.0, I see the following error in the browser console:

node:string_decoder?from=apache-arrow:14 Uncaught Error: [Package Error] "string_decoder" does not exist. (Imported by "apache-arrow").
 at node:string_decoder?from=apache-arrow:14

I haven't dug deeper, but the "node:" prefix above suggests that perhaps server-side imports may be improperly included in a browser bundle?

> [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
>            Priority: Major
>
> 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)