2
dexie.js 求助
source link: https://www.v2ex.com/t/884322
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
我尝试使用 vite+dexie ,想在 webworker 使用 dexie 防止阻塞主线程,dev 时可以正常跑,build 时就会循环编译,不知道有没有大佬能帮帮我...🥲
import Dexie from 'dexie'
import dbWorker from './worker?worker'
export const db = new Dexie('test')
db.version(1).stores({
test: '++id, test'
})
const worker = new dbWorker()
export function test(data: string) {
worker.postMessage(data)
}
- worker
import { db } from './index'
self.addEventListener('message', event => {
console.log(db)
})
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK