Skip to content

Commit

Permalink
manually patch package.json fixes rustwasm/wasm-pack#1039
Browse files Browse the repository at this point in the history
  • Loading branch information
acdamiani committed Mar 25, 2023
1 parent e855174 commit ab3195e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions build_wasm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#! /bin/bash

if !command -v js &> /dev/null
then
echo "jq command not found"
exit 127
fi

if !command -v wasm-pack &> /dev/null
then
echo "wasm-pack command not found"
exit 127
fi

if [ ! -d "./rs" ]
then
echo "could not find crate \"rs\""
exit 2
fi

cd rs
wasm-pack build --target web

tmp=$(mktemp)

cd pkg
jq '. += { type: "module" }' package.json > "$tmp" && mv "$tmp" package.json
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"build:wasm": "wasm-pack build ./rs --target web",
"build:wasm": "./build_wasm.sh",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
Expand Down

0 comments on commit ab3195e

Please sign in to comment.