Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing sharing issues #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion checkout/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = withFederatedSidecar({
config.output.publicPath = "auto";

config.module.rules.push({
test: /_app.js/,
test: /_app.tsx/,
loader: "@module-federation/nextjs-mf/lib/federation-loader.js",
});
if (options.isServer) {
Expand Down
25 changes: 12 additions & 13 deletions checkout/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
import dynamic from "next/dynamic";
// const NavLayout = dynamic(
// () => {
// return window.home?.get("./NavLayout").then((factory) => factory());
// },
// {
// loading: () => <div>NavLayout is loading</div>,
// ssr: false
// }
// );
const NavLayout = dynamic(
() => {
const mod = import("home/NavLayout");
console.log(mod);
return mod;
return window.home?.get("./NavLayout").then((factory) => factory());
},
{ ssr: false }
{
ssr: false
}
);
// const NavLayout = dynamic(
// () => {
// const mod = import("home/NavLayout");
// console.log(mod);
// return mod;
// },
// { ssr: false }
// );

function MyApp({ Component, pageProps }: any) {
return (
Expand Down
2 changes: 1 addition & 1 deletion home/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = withFederatedSidecar({
config.experiments = { topLevelAwait: true };

config.module.rules.push({
test: /_app.js/,
test: /_app.tsx/,
loader: "@module-federation/nextjs-mf/lib/federation-loader.js",
});

Expand Down
27 changes: 13 additions & 14 deletions home/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ import React from "react";
import Head from "next/head";
import dynamic from "next/dynamic";

// const RemoteTitle = dynamic(
// () => {
// return window.checkout?.get("./title").then((factory) => factory());
// },
// {
// loading: () => <div>RemoteTitle is loading</div>,
// ssr: false
// }
// );
const RemoteTitle = dynamic(() => import('checkout/title'),
{
loading: () => <div>RemoteTitle is loading</div>,
ssr: false
});
const RemoteTitle = dynamic(
() => {
return window.checkout?.get("./title").then((factory) => factory());
},
{
ssr: false
}
);
// const RemoteTitle = dynamic(() => import('checkout/title'),
// {
// loading: () => <div>RemoteTitle is loading</div>,
// ssr: false
// });

const Home = ({}: any) => {
return (
Expand Down