Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.72 KB

DEVELOP.md

File metadata and controls

44 lines (31 loc) · 1.72 KB

Development

  • Install wasm-pack
  • Compile: wasm-pack build, or change targets, e.g. wasm-pack build --target nodejs
  • Publish wasm-pack publish.

MacOS

Some steps may need a specific configuration if run on MacOS. Specifically, the default clang shipped with Macs (as of March 2022) doesn't have WebAssembly compilation supported out of the box. To build ZSTD, you may need to install a later version via Homebrew and update your paths to find the correct executables.

brew install llvm
export PATH="/usr/local/opt/llvm/bin/:$PATH"
export CC=/usr/local/opt/llvm/bin/clang
export AR=/usr/local/opt/llvm/bin/llvm-ar

Note that homebrew paths are different on an Apple ARM-based Mac:

brew install llvm
export PATH="/opt/homebrew/opt/llvm/bin/:$PATH"
export CC=/opt/homebrew/opt/llvm/bin/clang
export AR=/opt/homebrew/opt/llvm/bin/llvm-ar

See this description and its references for more info.

Publishing

wasm-pack supports three different targets:

  • bundler (used with bundlers like Webpack)
  • nodejs (used with Node, supports require)
  • web (used as an ES module directly from the web)

There are good reasons to distribute as any of these... so why not distribute as all three? wasm-pack doesn't support this directly but the build script in scripts/build.sh calls wasm-pack three times and merges the outputs. This means that bundler users can use the default, Node users can use parquet-wasm/node and ES Modules users can use parquet-wasm/web in their imports.

To publish:

yarn build
wasm-pack publish