Skip to content

Commit

Permalink
馃摝 refactor: import fasttext js binding directly
Browse files Browse the repository at this point in the history
Vite still not support dynamic import, ref: vitejs/vite#11804
  • Loading branch information
yunsii committed Jan 3, 2024
1 parent b9df0f6 commit 7968c6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/helpers/models/browser.ts
@@ -1,6 +1,6 @@
import fastTextModularized from '../../core/fastText.browser'

export async function initializeFastTextModule() {
const fastTextModularized = (await import('../../core/fastText.browser'))
.default
globalThis.fastTextModule ??= await fastTextModularized()
return globalThis.fastTextModule
}
3 changes: 2 additions & 1 deletion src/helpers/models/node.ts
@@ -1,5 +1,6 @@
import fastTextModularized from '../../core/fastText.browser'

export async function initializeFastTextModule() {
const fastTextModularized = (await import('../../core/fastText.node')).default
globalThis.fastTextModule ??= await fastTextModularized()
return globalThis.fastTextModule
}

0 comments on commit 7968c6a

Please sign in to comment.