Simplifying the Integration of Elixir, JavaScript, and WebAssembly in a Unified NPM Package

38
clicks
Simplifying the Integration of Elixir, JavaScript, and WebAssembly in a Unified NPM Package

Source: swmansion.com

Type: Post

The article elaborates on the development of Popcorn, a library designed to execute Elixir in web browsers by integrating it with JavaScript and WebAssembly (Wasm). It covers the initial challenges of managing separate JavaScript files and the Elixir Hex package, describing how they transitioned to a single npm package to simplify installation and usage for developers. The author explains the technical architecture, particularly their use of AtomVM (a BEAM runtime written in C) that compiles to Wasm using Emscripten, and the difficulties faced in allowing effective communication between different components, including the main script, iframe, and WebWorkers. It also addresses limitations encountered with popular JavaScript bundlers concerning Wasm integration, and the eventual solution involved developing a plugin to streamline the integration process. The article concludes by inviting users to engage with the new package and highlighting ongoing improvements and features being tested.

© HashMerge 2026