Skip to content

Commit

Permalink
Issue #PS-2103: Add Workspace UI implementation in admin portal
Browse files Browse the repository at this point in the history
  • Loading branch information
Arif-tekdi-technologies committed Oct 10, 2024
1 parent 5960a67 commit 8e7316d
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// next.config.mjs
/** @type {import('next').NextConfig} */
import nextI18nextConfig from "./next-i18next.config.js";
import { NextFederationPlugin } from '@module-federation/nextjs-mf';
const url = process.env.NEXT_PUBLIC_REMOTE_EDITOR_URL

import { NextFederationPlugin } from "@module-federation/nextjs-mf";
const url = process.env.WORKSPACE_BASE_URL;
// const url = "http://localhost:3000";

const remotes = (isServer) => {
const location = isServer ? 'ssr' : 'chunks';
const location = isServer ? "ssr" : "chunks";
return {
editor: `editor@${url}/_next/static/${location}/remoteEntry.js`,
};
Expand All @@ -21,7 +21,7 @@ const nextConfig = {
reactStrictMode: true,
i18n: nextI18nextConfig.i18n,

distDir: 'build',
distDir: "build",
images: {
unoptimized: true,
},
Expand All @@ -30,27 +30,36 @@ const nextConfig = {
esmExternals: false,
},
async rewrites() {
return [
return [
{
source: "/action/asset/v1/upload/:identifier*", // Match asset upload routes
destination: `${process.env.WORKSPACE_BASE_URL}/api/fileUpload`, // Forward asset uploads to fileUpload.js
},
{
source: "/action/asset/:path*", // Match other /action/asset routes
destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/asset/:path*`, // Forward other /action/asset requests to proxy.js
},
{
source: '/action/:path*',
destination: '/api/proxy?path=/action/:path*',
source: "/action/:path*", // Match any other routes starting with /action/
destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/action/:path*`, // Forward them to proxy.js
},
{
source: '/api/:path*',
destination: '/api/proxy?path=/api/:path*',
}
source: "/api/:path*", // Match /api/ routes
destination: `${process.env.WORKSPACE_BASE_URL}/api/proxy?path=/api/:path*`, // Forward them to proxy.js
},
{
source: "/assets/public/:path*", // Match any URL starting with /assets/public/
destination: `${process.env.CLOUD_STORAGE_URL}/:path*`, // Forward to S3, stripping "/assets/public"
},
];
},
webpack: (config, { isServer }) => {
config.plugins.push(
new NextFederationPlugin({
name: 'admin',
filename: 'static/chunks/remoteEntry.js',
name: "admin",
filename: "static/chunks/remoteEntry.js",
remotes: remotes(isServer),
exposes: {

},

exposes: {},
})
);
return config;
Expand Down

0 comments on commit 8e7316d

Please sign in to comment.