Commit fc9988e
feat: add browser-only WASM build to eliminate Node.js require() warnings in bundlers
When bundling sql.js for browser environments, tools like Vite, Webpack,
and esbuild emit warnings about `require("node:fs")` and
`require("node:crypto")` being externalized for browser compatibility.
This adds a new `sql-wasm-browser.js` build variant compiled with
`-s ENVIRONMENT=web,worker`, which completely eliminates Node.js code
paths from the generated JavaScript. The browser variant is exposed via
the `exports` field in package.json using the `browser` condition, so
bundlers automatically select the clean version.
The original `sql-wasm.js` with full Node.js support is preserved as
the `default` export, ensuring no breaking changes for existing users.
Closes #620
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 52e5649 commit fc9988e
2 files changed
+26
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
76 | | - | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| |||
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
90 | 101 | | |
91 | | - | |
| 102 | + | |
92 | 103 | | |
93 | 104 | | |
94 | 105 | | |
| |||
102 | 113 | | |
103 | 114 | | |
104 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
105 | 122 | | |
106 | 123 | | |
107 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
| |||
0 commit comments