From c99f2fcdbb004007d205d7a7c389a4165a07dad4 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:37:35 +0530 Subject: [PATCH] fix: yjs duplicate import error (#5297) --- web/next.config.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web/next.config.js b/web/next.config.js index bb721e8d1..423e8273f 100644 --- a/web/next.config.js +++ b/web/next.config.js @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/no-var-requires */ /** @type {import("next").NextConfig} */ require("dotenv").config({ path: ".env" }); +const path = require("path"); + const { withSentryConfig } = require("@sentry/nextjs"); const withPWA = require("next-pwa")({ dest: "public", @@ -34,6 +36,13 @@ const nextConfig = { ], unoptimized: true, }, + webpack: (config, { isServer }) => { + if (!isServer) { + // Ensure that all imports of 'yjs' resolve to the same instance + config.resolve.alias["yjs"] = path.resolve(__dirname, "node_modules/yjs"); + } + return config; + }, async redirects() { return [ {