Skip to content

Commit c039617

Browse files
committed
browserpod: add guide on native deps
1 parent 20f5b0a commit c039617

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
File renamed without changes.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: Native binaries
3+
description: Using packages with native binary components
4+
---
5+
6+
## Overview
7+
8+
BrowserPod can run any JavaScript code that runs in Node.js. But there are NPM
9+
packages that ship native binary components for specific architectures.
10+
These are usually build-time tools like compilers and bundlers.
11+
12+
These native binaries cannot run in BrowserPod, but they often have alternatives
13+
that are compiled to WebAssembly and are thus truly cross-platform.
14+
15+
In order to use these alternatives, you need to specify them as overrides in your
16+
package.json file.
17+
18+
In this page you can find a list of well-known packages with native binary dependencies
19+
and their corresponding WebAssembly overrides.
20+
21+
## esbuild
22+
23+
This is a very commonly used bundler. It can be used directly but it's also a
24+
dependency of the _vite_ build tool.
25+
26+
To replace it with the WebAssembly version, add this to your package.json:
27+
28+
```json
29+
{
30+
...,
31+
"overrides": {
32+
"esbuild": "npm:esbuild-wasm@*",
33+
},
34+
...
35+
}
36+
```
37+
38+
## rollup
39+
40+
This is a very commonly used bundler. It can be used directly but it's also a
41+
dependency of the _vite_ build tool.
42+
43+
To replace it with the WebAssembly version, add this to your package.json:
44+
45+
```json
46+
{
47+
...,
48+
"overrides": {
49+
"rollup": "npm:@rollup/wasm-node@*"
50+
},
51+
...
52+
}
53+
```

0 commit comments

Comments
 (0)