Skip to content

Commit

Permalink
Make load path of index_bg.wasm more dynamic in accordance with vite'…
Browse files Browse the repository at this point in the history
…s wishes.
  • Loading branch information
Benjamin Clark committed Apr 12, 2024
1 parent 280646d commit 12e3468
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"vite": "^5.2.8",
"vite-plugin-wasm": "^3.3.0"
"vite": "^5.2.8"
},
"volta": {
"node": "20.11.1"
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion site/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import ReactDOM from 'react-dom/client'
import App from './App.jsx'
import './index.css'
import initWasm, {ParquetFile} from "@geoarrow/geoarrow-wasm/esm/index.js";
import index_bg from '/index_bg.wasm?url'

ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)

await initWasm();
console.log(`Attempting to load parquet-wasm from url '${index_bg}'`)
await initWasm(index_bg);

const url =
"https://overturemaps-us-west-2.s3.amazonaws.com/release/2023-11-14-alpha.0/theme=transportation/type=segment/part-00158-6cb89013-4ec2-4b94-8e4b-8e27c7d30865.c000.zstd.parquet";
Expand Down
10 changes: 5 additions & 5 deletions site/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import wasm from 'vite-plugin-wasm'
//import wasmPack from 'vite-plugin-wasm-pack'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), wasm()],
plugins: [react()],
build: {
target: 'esnext',
}
// plugins: [react(), wasmPack([],['@geoarrow/geoarrow-wasm/esm/index_bg'] )],
},
optimizeDeps: {
exclude: ["@rollup/browser"],
},
})

0 comments on commit 12e3468

Please sign in to comment.