Skip to content
Merged
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 advanced-api/automatic-vendor-sharing/app1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"babel-loader": "8.1.0",
"html-webpack-plugin": "git://github.com/ScriptedAlchemy/html-webpack-plugin#master",
"serve": "11.3.2",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
},
Expand Down
4 changes: 1 addition & 3 deletions advanced-api/automatic-vendor-sharing/app1/public/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<html>
<head>
<script src="http://localhost:3002/remoteEntry.js"></script>
</head>
<head> </head>
<body>
<div id="root"></div>
</body>
Expand Down
3 changes: 1 addition & 2 deletions advanced-api/automatic-vendor-sharing/app1/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ module.exports = {
plugins: [
new ModuleFederationPlugin({
name: "app1",
library: { type: "var", name: "app1" },
filename: "remoteEntry.js",
remotes: {
app2: "app2",
app2: "app2@http://localhost:3002/remoteEntry.js",
},
exposes: {
"./Button": "./src/Button",
Expand Down
2 changes: 1 addition & 1 deletion advanced-api/automatic-vendor-sharing/app2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"babel-loader": "8.1.0",
"html-webpack-plugin": "git://github.com/ScriptedAlchemy/html-webpack-plugin#master",
"serve": "11.3.2",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
},
Expand Down
4 changes: 1 addition & 3 deletions advanced-api/automatic-vendor-sharing/app2/public/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<html>
<head>
<script src="http://localhost:3001/remoteEntry.js"></script>
</head>
<head> </head>
<body>
<div id="root"></div>
</body>
Expand Down
3 changes: 1 addition & 2 deletions advanced-api/automatic-vendor-sharing/app2/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ module.exports = {
plugins: [
new ModuleFederationPlugin({
name: "app2",
library: { type: "var", name: "app2" },
filename: "remoteEntry.js",
remotes: {
app1: "app1",
app1: "app1@http://localhost:3001/remoteEntry.js",
},
exposes: {
"./Button": "./src/Button",
Expand Down
2 changes: 1 addition & 1 deletion advanced-api/dynamic-remotes/app1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"babel-loader": "8.1.0",
"html-webpack-plugin": "git://github.com/ScriptedAlchemy/html-webpack-plugin#master",
"serve": "11.3.2",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
},
Expand Down
1 change: 1 addition & 0 deletions advanced-api/dynamic-remotes/app1/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function loadComponent(scope, module) {
return async () => {
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
await __webpack_init_sharing__("default");

const container = window[scope]; // or get the container somewhere else
// Initialize the container, it may provide shared modules
await container.init(__webpack_share_scopes__.default);
Expand Down
12 changes: 11 additions & 1 deletion advanced-api/dynamic-remotes/app1/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ module.exports = {
// version is inferred from package.json
// there is no version check for the required version
// so it will always use the higher version found
shared: ["react", "react-dom"],
shared: {
react: {
import: "react", // the "react" package will be used a provided and fallback module
shareKey: "react", // under this name the shared module will be placed in the share scope
shareScope: "default", // share scope with this name will be used
singleton: true, // only a single version of the shared module is allowed
},
"react-dom": {
singleton: true, // only a single version of the shared module is allowed
},
},
}),
new HtmlWebpackPlugin({
template: "./public/index.html",
Expand Down
2 changes: 1 addition & 1 deletion advanced-api/dynamic-remotes/app2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"babel-loader": "8.1.0",
"html-webpack-plugin": "git://github.com/ScriptedAlchemy/html-webpack-plugin#master",
"serve": "11.3.2",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
},
Expand Down
4 changes: 3 additions & 1 deletion advanced-api/dynamic-remotes/app2/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ module.exports = {
"./Widget": "./src/Widget",
},
shared: {
"react-dom": "react-dom",
moment: "^2.24.0",
react: {
import: "react", // the "react" package will be used a provided and fallback module
shareKey: "react", // under this name the shared module will be placed in the share scope
shareScope: "default", // share scope with this name will be used
singleton: true, // only a single version of the shared module is allowed
},
"react-dom": {
singleton: true, // only a single version of the shared module is allowed
},
},
}),
new HtmlWebpackPlugin({
Expand Down
2 changes: 1 addition & 1 deletion advanced-api/dynamic-remotes/app3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"babel-loader": "8.1.0",
"html-webpack-plugin": "git://github.com/ScriptedAlchemy/html-webpack-plugin#master",
"serve": "11.3.2",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
},
Expand Down
19 changes: 12 additions & 7 deletions advanced-api/dynamic-remotes/app3/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,21 @@ module.exports = {
// version is inferred from package.json
// there is no version check for the required version
// so it will always use the higher version found
shared: [
"react",
"react-dom",
shared: {
react: {
import: "react", // the "react" package will be used a provided and fallback module
shareKey: "react", // under this name the shared module will be placed in the share scope
shareScope: "default", // share scope with this name will be used
singleton: true, // only a single version of the shared module is allowed
},
"react-dom": {
singleton: true, // only a single version of the shared module is allowed
},
// adds moment as shared module
// version is inferred from package.json
// it will use the highest moment version that is >= 2.24 and < 3
{
moment: "^2.24.0",
},
],
moment: "^2.24.0",
},
}),
new HtmlWebpackPlugin({
template: "./public/index.html",
Expand Down
2 changes: 1 addition & 1 deletion angular-universal-ssr/client-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ts-node": "8.3.0",
"tslint": "6.1.2",
"typescript": "3.9.6",
"webpack": "file:../patched_packages/webpack-5.0.0-beta.16.tgz",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12"
}
}
2 changes: 1 addition & 1 deletion angular-universal-ssr/host-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"ts-node": "8.3.0",
"tslint": "6.1.2",
"typescript": "3.9.6",
"webpack": "file:../patched_packages/webpack-5.0.0-beta.16.tgz",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12"
}
}
2 changes: 1 addition & 1 deletion basic-host-remote/app1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"bundle-loader": "0.5.6",
"html-webpack-plugin": "git://github.com/ScriptedAlchemy/html-webpack-plugin#master",
"serve": "11.3.2",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
},
Expand Down
4 changes: 1 addition & 3 deletions basic-host-remote/app1/public/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<html>
<head>
<script src="http://localhost:3002/remoteEntry.js"></script>
</head>
<head> </head>
<body>
<div id="root"></div>
</body>
Expand Down
6 changes: 3 additions & 3 deletions basic-host-remote/app1/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ module.exports = {
},
],
},
//http://localhost:3002/remoteEntry.js
plugins: [
new ModuleFederationPlugin({
name: "app1",
library: { type: "var", name: "app1" },
remotes: {
app2: "app2",
app2: "app2@http://localhost:3002/remoteEntry.js",
},
shared: ["react", "react-dom"],
shared: { react: { singleton: true }, "react-dom": { singleton: true } },
}),
new HtmlWebpackPlugin({
template: "./public/index.html",
Expand Down
2 changes: 1 addition & 1 deletion basic-host-remote/app2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"babel-loader": "8.1.0",
"html-webpack-plugin": "git://github.com/ScriptedAlchemy/html-webpack-plugin#master",
"serve": "11.3.2",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
},
Expand Down
2 changes: 1 addition & 1 deletion basic-host-remote/app2/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
exposes: {
"./Button": "./src/Button",
},
shared: ["react", "react-dom"],
shared: { react: { singleton: true }, "react-dom": { singleton: true } },
}),
new HtmlWebpackPlugin({
template: "./public/index.html",
Expand Down
4 changes: 0 additions & 4 deletions basic-host-remote/yarn.lock

This file was deleted.

2 changes: 1 addition & 1 deletion bi-directional/app1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"babel-loader": "8.1.0",
"html-webpack-plugin": "git://github.com/ScriptedAlchemy/html-webpack-plugin#master",
"serve": "11.3.2",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
},
Expand Down
4 changes: 1 addition & 3 deletions bi-directional/app1/public/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<html>
<head>
<script src="http://localhost:3002/remoteEntry.js"></script>
</head>
<head> </head>
<body>
<div id="root"></div>
</body>
Expand Down
5 changes: 5 additions & 0 deletions bi-directional/app1/src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";

ReactDOM.render(<App />, document.getElementById("root"));
6 changes: 1 addition & 5 deletions bi-directional/app1/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";

ReactDOM.render(<App />, document.getElementById("root"));
import("./bootstrap");
29 changes: 15 additions & 14 deletions bi-directional/app1/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,29 @@ module.exports = {
plugins: [
new ModuleFederationPlugin({
name: "app1",
library: { type: "var", name: "app1" },
filename: "remoteEntry.js",
remotes: {
app2: "app2",
app2: "app2@http://localhost:3002/remoteEntry.js",
},
exposes: {
"./Button": "./src/Button",
},
// sharing code based on the installed version, to allow for multiple vendors with different versions
shared: {
...deps,
react: {
eager: true,
singleton: true,
requiredVersion: deps.react,
shared: [
{
...deps,
react: {
// eager: true,
singleton: true,
requiredVersion: deps.react,
},
"react-dom": {
// eager: true,
singleton: true,
requiredVersion: deps["react-dom"],
},
},
"react-dom": {
eager: true,
singleton: true,
requiredVersion: deps["react-dom"],
},
},
],
}),
new HtmlWebpackPlugin({
template: "./public/index.html",
Expand Down
2 changes: 1 addition & 1 deletion bi-directional/app2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"babel-loader": "8.1.0",
"html-webpack-plugin": "git://github.com/ScriptedAlchemy/html-webpack-plugin#master",
"serve": "11.3.2",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.0"
},
Expand Down
4 changes: 1 addition & 3 deletions bi-directional/app2/public/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<html>
<head>
<script src="http://localhost:3001/remoteEntry.js"></script>
</head>
<head> </head>
<body>
<div id="root"></div>
</body>
Expand Down
5 changes: 5 additions & 0 deletions bi-directional/app2/src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";

ReactDOM.render(<App />, document.getElementById("root"));
6 changes: 1 addition & 5 deletions bi-directional/app2/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";

ReactDOM.render(<App />, document.getElementById("root"));
import("./bootstrap");
29 changes: 15 additions & 14 deletions bi-directional/app2/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,28 @@ module.exports = {
plugins: [
new ModuleFederationPlugin({
name: "app2",
library: { type: "var", name: "app2" },
filename: "remoteEntry.js",
remotes: {
app1: "app1",
app1: "app1@http://localhost:3001/remoteEntry.js",
},
exposes: {
"./Button": "./src/Button",
},
shared: {
...deps,
react: {
eager: true,
singleton: true,
requiredVersion: deps.react,
shared: [
{
...deps,
react: {
// eager: true,
singleton: true,
requiredVersion: deps.react,
},
"react-dom": {
// eager: true,
singleton: true,
requiredVersion: deps["react-dom"],
},
},
"react-dom": {
eager: true,
singleton: true,
requiredVersion: deps["react-dom"],
},
},
],
}),
new HtmlWebpackPlugin({
template: "./public/index.html",
Expand Down
2 changes: 1 addition & 1 deletion comprehensive-demo/app-01/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"react-dom": "^16.13.0",
"react-router-dom": "^5.1.2",
"serve": "^11.3.0",
"webpack": "5.0.0-beta.18",
"webpack": "5.0.0-beta.22",
"webpack-cli": "^3.3.11"
},
"scripts": {
Expand Down
Loading