Skip to content

Commit e511d49

Browse files
authoredJun 23, 2020
fix: addressing issues in prod build (#114)
1 parent 416eda6 commit e511d49

File tree

6 files changed

+75
-25
lines changed

6 files changed

+75
-25
lines changed
 

‎.prettierignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/dist
2+
**/build
3+
**/buildServer
4+
**/buildClient

‎shared-routing/dashboard/webpack.config.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
22
const ModuleFederationPlugin = require("webpack").container
33
.ModuleFederationPlugin;
44
const path = require("path");
5-
5+
const deps = require("./package.json").dependen;
66
module.exports = {
77
entry: "./src/index",
88
mode: "development",
@@ -15,6 +15,7 @@ module.exports = {
1515
},
1616
output: {
1717
publicPath: "http://localhost:3001/",
18+
chunkFilename: "[id].[contenthash].js",
1819
},
1920
resolve: {
2021
alias: {
@@ -46,7 +47,19 @@ module.exports = {
4647
exposes: {
4748
"./DashboardService": "./src/DashboardService",
4849
},
49-
shared: ["react", "react-dom", "@material-ui/core", "@material-ui/icons"],
50+
shared: [
51+
{
52+
...deps,
53+
react: {
54+
singleton: true,
55+
requiredVersion: deps.react,
56+
},
57+
"react-dom": {
58+
singleton: true,
59+
requiredVersion: deps["react-dom"],
60+
},
61+
},
62+
],
5063
}),
5164
new HtmlWebpackPlugin({
5265
template: "./public/index.html",

‎shared-routing/order/webpack.config.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
22
const ModuleFederationPlugin = require("webpack").container
33
.ModuleFederationPlugin;
44
const path = require("path");
5-
5+
const deps = require("./package.json").dependencies;
66
module.exports = {
77
entry: "./src/index",
88
mode: "development",
@@ -15,6 +15,7 @@ module.exports = {
1515
},
1616
output: {
1717
publicPath: "http://localhost:3002/",
18+
chunkFilename: "[id].[contenthash].js",
1819
},
1920
resolve: {
2021
alias: {
@@ -45,7 +46,19 @@ module.exports = {
4546
"./RecentOrdersWidget": "./src/RecentOrdersWidget",
4647
"./OrderService": "./src/OrderService",
4748
},
48-
shared: ["react", "react-dom", "@material-ui/core", "@material-ui/icons"],
49+
shared: [
50+
{
51+
...deps,
52+
react: {
53+
singleton: true,
54+
requiredVersion: deps.react,
55+
},
56+
"react-dom": {
57+
singleton: true,
58+
requiredVersion: deps["react-dom"],
59+
},
60+
},
61+
],
4962
}),
5063
new HtmlWebpackPlugin({
5164
template: "./public/index.html",

‎shared-routing/profile/webpack.config.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
22
const ModuleFederationPlugin = require("webpack").container
33
.ModuleFederationPlugin;
44
const path = require("path");
5-
5+
const deps = require("./package.json").dependencies;
66
module.exports = {
77
entry: "./src/index",
88
mode: "development",
@@ -15,6 +15,7 @@ module.exports = {
1515
},
1616
output: {
1717
publicPath: "http://localhost:3004/",
18+
chunkFilename: "[id].[contenthash].js",
1819
},
1920
module: {
2021
rules: [
@@ -47,7 +48,19 @@ module.exports = {
4748
exposes: {
4849
"./ProfilePage": "./src/ProfilePage",
4950
},
50-
shared: ["react", "react-dom", "@material-ui/core", "@material-ui/icons"],
51+
shared: [
52+
{
53+
...deps,
54+
react: {
55+
singleton: true,
56+
requiredVersion: deps.react,
57+
},
58+
"react-dom": {
59+
singleton: true,
60+
requiredVersion: deps["react-dom"],
61+
},
62+
},
63+
],
5164
}),
5265
new HtmlWebpackPlugin({
5366
template: "./public/index.html",

‎shared-routing/sales/webpack.config.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
22
const ModuleFederationPlugin = require("webpack").container
33
.ModuleFederationPlugin;
44
const path = require("path");
5-
5+
const deps = require("./package.json").dependencies;
66
module.exports = {
77
entry: "./src/index",
88
mode: "development",
@@ -15,11 +15,7 @@ module.exports = {
1515
},
1616
output: {
1717
publicPath: "http://localhost:3003/",
18-
},
19-
resolve: {
20-
alias: {
21-
events: "events",
22-
},
18+
chunkFilename: "[id].[contenthash].js",
2319
},
2420
resolve: {
2521
alias: {
@@ -54,11 +50,17 @@ module.exports = {
5450
"./DepositsWidget": "./src/DepositsWidget",
5551
},
5652
shared: [
57-
"react",
58-
"react-dom",
59-
"@material-ui/core",
60-
"@material-ui/icons",
61-
"recharts",
53+
{
54+
...deps,
55+
react: {
56+
singleton: true,
57+
requiredVersion: deps.react,
58+
},
59+
"react-dom": {
60+
singleton: true,
61+
requiredVersion: deps["react-dom"],
62+
},
63+
},
6264
],
6365
}),
6466
new HtmlWebpackPlugin({

‎shared-routing/shell/webpack.config.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
22
const ModuleFederationPlugin = require("webpack").container
33
.ModuleFederationPlugin;
44
const path = require("path");
5-
5+
const deps = require("./package.json").dependencies;
66
module.exports = {
77
entry: "./src/index",
88
mode: "development",
@@ -20,6 +20,7 @@ module.exports = {
2020
},
2121
output: {
2222
publicPath: "http://localhost:3000/",
23+
chunkFilename: "[id].[contenthash].js",
2324
},
2425
module: {
2526
rules: [
@@ -48,13 +49,17 @@ module.exports = {
4849
"./Service": "./src/Service",
4950
},
5051
shared: [
51-
"react",
52-
"react-dom",
53-
"@material-ui/core",
54-
"@material-ui/icons",
55-
"react-router",
56-
"react-router-dom",
57-
"./src/Service",
52+
{
53+
...deps,
54+
react: {
55+
singleton: true,
56+
requiredVersion: deps.react,
57+
},
58+
"react-dom": {
59+
singleton: true,
60+
requiredVersion: deps["react-dom"],
61+
},
62+
},
5863
],
5964
}),
6065
new HtmlWebpackPlugin({

0 commit comments

Comments
 (0)
Please sign in to comment.