Commit 752cfaa
authored
Add Vite plugin to remove unnecessary `import.meta.url` argument from
data: URLs during build.
## Problem
wasm-pack generates: `new URL("data:...", import.meta.url)`
The `import.meta.url` argument is unnecessary for data: URLs and causes:
- Webpack 5: "Invalid generator object" error
- Vite: Incorrectly rewrites URL as filesystem path
## Solution
Transform during build:
- Before: `new URL("data:...", import.meta.url)`
- After: `new URL("data:...")`
This allows Next.js/webpack users to import spark normally without errors.
Fixes #95
1 parent 196721e commit 752cfaa
1 file changed
+30
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
7 | 34 | | |
8 | 35 | | |
9 | 36 | | |
| |||
32 | 59 | | |
33 | 60 | | |
34 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
35 | 65 | | |
36 | 66 | | |
37 | 67 | | |
| |||
0 commit comments