Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): use native WASM loading for Loro (#43786)

Stephen Zhou093194376f1c
diff --git a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.merge-behavior.test.ts b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.merge-behavior.test.ts
index 85b95c37c22..bc9d3a32189 100644
--- a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.merge-behavior.test.ts
+++ b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.merge-behavior.test.ts
@@ -1,6 +1,6 @@
-import type { LoroMap } from 'loro-crdt/base64'
+import type { LoroMap } from 'loro-crdt'
import type { Node } from '@/app/components/workflow/types'
-import { LoroDoc } from 'loro-crdt/base64'
+import { LoroDoc } from 'loro-crdt'
import { BlockEnum } from '@/app/components/workflow/types'
import { CollaborationManager } from '../collaboration-manager'
import { attachCrdtRuntime } from './test-crdt-runtime'
diff --git a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts
index 49151ca556e..973a17839f9 100644
--- a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts
+++ b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts
@@ -1,10 +1,10 @@
-import type { LoroMap } from 'loro-crdt/base64'
+import type { LoroMap } from 'loro-crdt'
import type {
NodePanelPresenceMap,
NodePanelPresenceUser,
} from '@/app/components/workflow/collaboration/types/collaboration'
import type { CommonNodeType, Edge, Node, PromptItem } from '@/app/components/workflow/types'
-import { LoroDoc } from 'loro-crdt/base64'
+import { LoroDoc } from 'loro-crdt'
import { Position } from 'reactflow'
import { CollaborationManager } from '@/app/components/workflow/collaboration/core/collaboration-manager'
import { BlockEnum, EditionType } from '@/app/components/workflow/types'
diff --git a/web/vite.config.ts b/web/vite.config.ts
index b7983596d3a..24e7af45dba 100644
--- a/web/vite.config.ts
+++ b/web/vite.config.ts
@@ -18,6 +18,10 @@ export default defineConfig(({ command, mode, isPreview }) => {
process.argv.some((arg) => arg.toLowerCase().includes('storybook'))
return {
+ build: {
+ // Match package.json's browserslist; these targets support native top-level await.
+ target: ['chrome111', 'edge111', 'firefox128', 'safari16.4', 'ios16.4'],
+ },
plugins: lazyPlugins(async () => {
const { default: react } = await import('@vitejs/plugin-react')
@@ -72,11 +76,7 @@ export default defineConfig(({ command, mode, isPreview }) => {
}),
resolve: {
tsconfigPaths: true,
- alias: [
- { find: '~@', replacement: projectRoot },
- // Use the base64 build in Vite-based pipelines (vinext/vitest) to avoid wasm loader incompatibilities.
- { find: /^loro-crdt$/, replacement: 'loro-crdt/base64' },
- ],
+ alias: [{ find: '~@', replacement: projectRoot }],
},
// vinext related config
...(!isTest && !isStorybook