Closed gy1016 closed 2 years ago
Hi,
I could not reproduce the same error, but while trying with vite+vue3, I encountered another error. I was able to overcome this issue by compiling gdal3.js with rollup instead of webpack. I have released new version 2.1.0 and this version is working for me as below. Can you try this version?
<script setup>
import { ref } from 'vue'
import workerUrl from 'gdal3.js/dist/package/gdal3.js?url'
import dataUrl from 'gdal3.js/dist/package/gdal3WebAssembly.data?url'
import wasmUrl from 'gdal3.js/dist/package/gdal3WebAssembly.wasm?url'
import initGdalJs from 'gdal3.js';
const paths = {
wasm: wasmUrl,
data: dataUrl,
js: workerUrl,
};
const count = ref(0);
initGdalJs({paths}).then((Gdal) => {
count.value = Object.keys(Gdal.drivers.raster).length + Object.keys(Gdal.drivers.vector).length;
});
</script>
<template>
<div>Number of drivers: {{ count }}</div>
</template>
thx
when I use gdal3.js in a vite + vue3 project, import initGdalJs from 'gdal3.js' throw error -> TypeError: Cannot read properties of undefined (reading 'prototype') how do i handle it