From cf2d070c7bbb0d5f447cfe33f69e07bcf85f8ddb Mon Sep 17 00:00:00 2001 From: Valentin Semirulnik Date: Mon, 4 May 2020 19:32:19 +0300 Subject: [PATCH] Fix ssr example (#18) * fix filename for module federation * add interactive example into ssr example --- server-side-rendering/website1/src/components/App.js | 2 +- .../website2/build/webpack.config.js/client.base.js | 2 +- server-side-rendering/website2/src/components/SomeComponent.js | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server-side-rendering/website1/src/components/App.js b/server-side-rendering/website1/src/components/App.js index d24a51a4b9a..e6cf32622f7 100755 --- a/server-side-rendering/website1/src/components/App.js +++ b/server-side-rendering/website1/src/components/App.js @@ -3,7 +3,7 @@ import React from "react"; import SomeComponent from "website2/SomeComponent"; export default () => (
-

This is website 1

+

alert("website1 is interactive")}>This is website 1

); diff --git a/server-side-rendering/website2/build/webpack.config.js/client.base.js b/server-side-rendering/website2/build/webpack.config.js/client.base.js index f2e3de633fc..c13b3106806 100755 --- a/server-side-rendering/website2/build/webpack.config.js/client.base.js +++ b/server-side-rendering/website2/build/webpack.config.js/client.base.js @@ -20,7 +20,7 @@ module.exports = merge.smart(common, { new ModuleFederationPlugin({ name: "website2", library: { type: "var", name: "website2" }, - filename: "src/index.js", + filename: "container.js", exposes: { SomeComponent: "./src/components/SomeComponent", }, diff --git a/server-side-rendering/website2/src/components/SomeComponent.js b/server-side-rendering/website2/src/components/SomeComponent.js index cd2724105d2..9f127382ada 100644 --- a/server-side-rendering/website2/src/components/SomeComponent.js +++ b/server-side-rendering/website2/src/components/SomeComponent.js @@ -8,6 +8,7 @@ const SomeComponent = () => ( border: "1px solid black", backgroundColor: "#ccc", }} + onClick={() => alert("website2 is interactive")} > Header