Web: Remove query hash from remoteEntry.js

This commit is contained in:
Alexey Safronov 2021-07-26 14:02:10 +03:00
parent 675fb8de21
commit 538d65c724
11 changed files with 26 additions and 48 deletions

View File

@ -1,6 +0,0 @@
const getUTCString = function () {
const utc = new Date();
return utc.toISOString();
};
module.exports = getUTCString;

View File

@ -6,7 +6,6 @@ const ModuleFederationPlugin = require("webpack").container
const ExternalTemplateRemotesPlugin = require("external-remotes-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const getUTCString = require("@appserver/common/utils/getUTCString");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const path = require("path");
@ -133,11 +132,11 @@ var config = {
new CleanWebpackPlugin(),
new ModuleFederationPlugin({
name: "crm",
filename: `remoteEntry.js?__hash=${getUTCString()}`,
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
AppServerConfig.proxyURL,
`/remoteEntry.js?__hash=${getUTCString()}`
"/remoteEntry.js"
)}`,
},
exposes: {

View File

@ -6,7 +6,6 @@ const ModuleFederationPlugin = require("webpack").container
const ExternalTemplateRemotesPlugin = require("external-remotes-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const getUTCString = require("@appserver/common/utils/getUTCString");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const path = require("path");
@ -133,11 +132,11 @@ var config = {
new CleanWebpackPlugin(),
new ModuleFederationPlugin({
name: "calendar",
filename: `remoteEntry.js?__hash=${getUTCString()}`,
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
AppServerConfig.proxyURL,
`/remoteEntry.js?__hash=${getUTCString()}`
"/remoteEntry.js"
)}`,
},
exposes: {

View File

@ -6,7 +6,6 @@ const ModuleFederationPlugin = require("webpack").container
const ExternalTemplateRemotesPlugin = require("external-remotes-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const getUTCString = require("@appserver/common/utils/getUTCString");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const path = require("path");
@ -133,15 +132,15 @@ var config = {
new CleanWebpackPlugin(),
new ModuleFederationPlugin({
name: "files",
filename: `remoteEntry.js?__hash=${getUTCString()}`,
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
AppServerConfig.proxyURL,
`/remoteEntry.js?__hash=${getUTCString()}`
"/remoteEntry.js"
)}`,
people: `people@${combineUrl(
AppServerConfig.proxyURL,
`/products/people/remoteEntry.js?__hash=${getUTCString()}`
"/products/people/remoteEntry.js"
)}`,
},
exposes: {

View File

@ -6,7 +6,6 @@ const ModuleFederationPlugin = require("webpack").container
const ExternalTemplateRemotesPlugin = require("external-remotes-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const getUTCString = require("@appserver/common/utils/getUTCString");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const path = require("path");
@ -133,11 +132,11 @@ var config = {
new CleanWebpackPlugin(),
new ModuleFederationPlugin({
name: "mail",
filename: `remoteEntry.js?__hash=${getUTCString()}`,
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
AppServerConfig.proxyURL,
`/remoteEntry.js?__hash=${getUTCString()}`
"/remoteEntry.js"
)}`,
},
exposes: {

View File

@ -6,7 +6,6 @@ const ModuleFederationPlugin = require("webpack").container
const ExternalTemplateRemotesPlugin = require("external-remotes-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const getUTCString = require("@appserver/common/utils/getUTCString");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const path = require("path");
@ -133,15 +132,15 @@ var config = {
new CleanWebpackPlugin(),
new ModuleFederationPlugin({
name: "people",
filename: `remoteEntry.js?__hash=${getUTCString()}`,
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
AppServerConfig.proxyURL,
`/remoteEntry.js?__hash=${getUTCString()}`
"/remoteEntry.js"
)}`,
people: `people@${combineUrl(
AppServerConfig.proxyURL,
`/products/people/remoteEntry.js?__hash=${getUTCString()}`
"/products/people/remoteEntry.js"
)}`,
},
exposes: {

View File

@ -6,7 +6,6 @@ const ModuleFederationPlugin = require("webpack").container
const ExternalTemplateRemotesPlugin = require("external-remotes-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const getUTCString = require("@appserver/common/utils/getUTCString");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const path = require("path");
@ -133,11 +132,11 @@ var config = {
new CleanWebpackPlugin(),
new ModuleFederationPlugin({
name: "projects",
filename: `remoteEntry.js?__hash=${getUTCString()}`,
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
AppServerConfig.proxyURL,
`/remoteEntry.js?__hash=${getUTCString()}`
"/remoteEntry.js"
)}`,
},
exposes: {

View File

@ -23,9 +23,6 @@ import System from "./components/System";
import { AppServerConfig } from "@appserver/common/constants";
import { Snackbar } from "@appserver/components/snackbar";
import moment from "moment";
import getUTCString from "../../../packages/asc-web-common/utils/getUTCString";
const utcString = getUTCString();
const { proxyURL } = AppServerConfig;
const homepage = config.homepage;
@ -148,6 +145,8 @@ const MyProfileRoute = (props) => (
</React.Suspense>
);
let index = 0;
const Shell = ({ items = [], page = "home", ...rest }) => {
const {
isLoaded,
@ -358,7 +357,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
const remoteEntryURL = combineUrl(
window.location.origin,
appURL,
`remoteEntry.js?__hash=${utcString}`
`remoteEntry.js?__index=${++index}`
);
const system = {

View File

@ -6,7 +6,6 @@ const ModuleFederationPlugin = require("webpack").container
const ExternalTemplateRemotesPlugin = require("external-remotes-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const getUTCString = require("@appserver/common/utils/getUTCString");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const path = require("path");
@ -130,19 +129,19 @@ const config = {
new CleanWebpackPlugin(),
new ModuleFederationPlugin({
name: "studio",
filename: `remoteEntry.js?__hash=${getUTCString()}`,
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
AppServerConfig.proxyURL,
`/remoteEntry.js?__hash=${getUTCString()}`
"/remoteEntry.js"
)}`,
login: `login@${combineUrl(
AppServerConfig.proxyURL,
`/login/remoteEntry.js?__hash=${getUTCString()}`
"/login/remoteEntry.js"
)}`,
people: `people@${combineUrl(
AppServerConfig.proxyURL,
`/products/people/remoteEntry.js?__hash=${getUTCString()}`
"/products/people/remoteEntry.js"
)}`,
},
exposes: {

View File

@ -6,7 +6,6 @@ const ModuleFederationPlugin = require("webpack").container
const ExternalTemplateRemotesPlugin = require("external-remotes-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const getUTCString = require("@appserver/common/utils/getUTCString");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const { proxyURL } = AppServerConfig;
@ -135,15 +134,12 @@ const config = {
new CleanWebpackPlugin(),
new ModuleFederationPlugin({
name: "editor",
filename: `remoteEntry.js?__hash=${getUTCString()}`,
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
proxyURL,
`/remoteEntry.js?__hash=${getUTCString()}`
)}`,
studio: `studio@${combineUrl(proxyURL, "/remoteEntry.js")}`,
files: `files@${combineUrl(
proxyURL,
`/products/files/remoteEntry.js?__hash=${getUTCString()}`
"/products/files/remoteEntry.js"
)}`,
},
exposes: {

View File

@ -6,7 +6,6 @@ const ModuleFederationPlugin = require("webpack").container
const ExternalTemplateRemotesPlugin = require("external-remotes-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const getUTCString = require("@appserver/common/utils/getUTCString");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const { proxyURL } = AppServerConfig;
@ -135,12 +134,9 @@ var config = {
new CleanWebpackPlugin(),
new ModuleFederationPlugin({
name: "login",
filename: `remoteEntry.js?__hash=${getUTCString()}`,
filename: "remoteEntry.js",
remotes: {
studio: `studio@${combineUrl(
proxyURL,
`/remoteEntry.js?__hash=${getUTCString()}`
)}`,
studio: `studio@${combineUrl(proxyURL, "/remoteEntry.js")}`,
},
exposes: {
"./app": "./src/Login.jsx",