Skip to content

Commit

Permalink
feat: support quasar (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloomingg authored Dec 24, 2024
1 parent 25222d7 commit 178580a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ dist

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

basepc
# yarn v2
.yarn/cache
.yarn/unplugged
Expand Down
8 changes: 7 additions & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function initWorker() {
// use for webpack5+ or vite
const isViteEnvironment = import.meta.url.includes('.vite/deps');
const isNuxtEnvironment = import.meta.url.includes('_nuxt/node_modules');
const isQuasarEnvironment = import.meta.url.includes('.q-cache');
const isSupportModuleWorker = supportsModuleWorkers();

let workerUrl = isSupportModuleWorker
? new URL('worker.js', import.meta.url)
: new URL('worker-legacy.js', import.meta.url);
Expand All @@ -50,6 +50,12 @@ function initWorker() {
'@openim/wasm-client-sdk/lib'
) as unknown as URL;
}
if (isQuasarEnvironment) {
workerUrl = workerUrl.href.replace(
/\.q-cache\/dev-spa\/[^/]+\/deps/,
'@openim/wasm-client-sdk/lib'
) as unknown as URL;
}
worker = new Worker(workerUrl, {
type: isSupportModuleWorker ? 'module' : 'classic',
});
Expand Down

0 comments on commit 178580a

Please sign in to comment.