From 8d756244316bfd2c707709349d39cdadcc14be2d Mon Sep 17 00:00:00 2001 From: Emmanuel Guyot Date: Sat, 22 Jun 2024 19:13:15 +0200 Subject: [PATCH 1/4] Add web.config for IIS deployement of the client --- client/.env | 3 ++ client/config-overrides.js | 24 +++++++++- client/package-lock.json | 93 ++++++++++++++++++++++++++++++++++++++ client/package.json | 1 + client/public/web.config | 17 +++++++ 5 files changed, 136 insertions(+), 2 deletions(-) create mode 100755 client/public/web.config diff --git a/client/.env b/client/.env index ec1a91b..d865a2d 100644 --- a/client/.env +++ b/client/.env @@ -1 +1,4 @@ REACT_APP_VERSION=1.20.1 +#REACT_APP_SERVER_BASE_URL=https://... +#PUBLIC_URL=https://... +#BASE_URL=/.../ diff --git a/client/config-overrides.js b/client/config-overrides.js index 2ea9da5..115e75a 100644 --- a/client/config-overrides.js +++ b/client/config-overrides.js @@ -1,5 +1,6 @@ const fs = require('fs'); const path = require('path'); +const CopyPlugin = require('copy-webpack-plugin'); const BASE_URL_PLACEHOLDER = 'BASE_URL_PLACEHOLDER'; @@ -32,7 +33,7 @@ const replaceBaseUrl = (compiler) => { replaceInFile(info.targetPath, `"${BASE_URL_PLACEHOLDER}"`, '`${window.BASE_URL}/`'); } else if (/index\.html$/.exec(info.targetPath)) { // For the main html file, we set a placeholder for sails to inject the correct value as runtime - replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, '<%= BASE_URL %>'); + replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, process.env.PUBLIC_URL); } } }); @@ -51,7 +52,26 @@ module.exports = function override(config, env) { return { ...config, output: { ...config.output, publicPath: BASE_URL_PLACEHOLDER }, - plugins: [...plugins, { apply: replaceBaseUrl }], + plugins: [ + ...plugins, + { apply: replaceBaseUrl }, + new CopyPlugin({ + patterns: [ + { + from: 'public/web.config', + transform: { + transformer(content, absoluteFrom) { + const PUBLIC_PATH = process.env.PUBLIC_URL.replace( + /^.*\/\/[^/]*(.*)[^?#]*.*$/, + '$1', + ); + return content.toString().replaceAll(BASE_URL_PLACEHOLDER, PUBLIC_PATH); + }, + }, + }, + ], + }), + ], }; } return config; diff --git a/client/package-lock.json b/client/package-lock.json index 0e5d8a6..d30c7f3 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -59,6 +59,7 @@ "@testing-library/user-event": "^14.5.2", "babel-preset-airbnb": "^5.0.0", "chai": "^4.4.1", + "copy-webpack-plugin": "^12.0.2", "eslint": "^8.57.0", "eslint-config-airbnb": "^19.0.4", "eslint-plugin-import": "^2.29.1", @@ -4940,6 +4941,18 @@ "optional": true, "peer": true }, + "node_modules/@sindresorhus/merge-streams": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", + "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@sinonjs/commons": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", @@ -8098,6 +8111,74 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/copy-webpack-plugin": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-12.0.2.tgz", + "integrity": "sha512-SNwdBeHyII+rWvee/bTnAYyO8vfVdcSTud4EIb6jcZ8inLeWucJE0DnxXQBjlQ5zlteuuvooGQy3LIyGxhvlOA==", + "dev": true, + "dependencies": { + "fast-glob": "^3.3.2", + "glob-parent": "^6.0.1", + "globby": "^14.0.0", + "normalize-path": "^3.0.0", + "schema-utils": "^4.2.0", + "serialize-javascript": "^6.0.2" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/copy-webpack-plugin/node_modules/globby": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", + "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", + "dev": true, + "dependencies": { + "@sindresorhus/merge-streams": "^2.1.0", + "fast-glob": "^3.3.2", + "ignore": "^5.2.4", + "path-type": "^5.0.0", + "slash": "^5.1.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/copy-webpack-plugin/node_modules/path-type": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", + "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/copy-webpack-plugin/node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/core-js": { "version": "3.37.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.37.1.tgz", @@ -26518,6 +26599,18 @@ "node": ">=4" } }, + "node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/unified": { "version": "10.1.2", "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", diff --git a/client/package.json b/client/package.json index 7e975a5..4c0a795 100755 --- a/client/package.json +++ b/client/package.json @@ -112,6 +112,7 @@ "@testing-library/user-event": "^14.5.2", "babel-preset-airbnb": "^5.0.0", "chai": "^4.4.1", + "copy-webpack-plugin": "^12.0.2", "eslint": "^8.57.0", "eslint-config-airbnb": "^19.0.4", "eslint-plugin-import": "^2.29.1", diff --git a/client/public/web.config b/client/public/web.config new file mode 100755 index 0000000..7d5e4b8 --- /dev/null +++ b/client/public/web.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + From 14a3ad2e2d8551e3e54b687f7fd108578cb13f83 Mon Sep 17 00:00:00 2001 From: Emmanuel Guyot Date: Wed, 17 Jul 2024 22:35:48 +0200 Subject: [PATCH 2/4] Fix default values & docker install --- client/.env | 6 +++--- client/package-lock.json | 8 +------- client/package.json | 2 +- client/public/web.config | 28 ++++++++++++++-------------- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/client/.env b/client/.env index d865a2d..1037d0b 100644 --- a/client/.env +++ b/client/.env @@ -1,4 +1,4 @@ REACT_APP_VERSION=1.20.1 -#REACT_APP_SERVER_BASE_URL=https://... -#PUBLIC_URL=https://... -#BASE_URL=/.../ +REACT_APP_SERVER_BASE_URL=http://localhost:1337 +PUBLIC_URL=http://localhost:3000/planka/ +BASE_URL=/planka/ diff --git a/client/package-lock.json b/client/package-lock.json index d30c7f3..88cd956 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -8,6 +8,7 @@ "dependencies": { "@juggle/resize-observer": "^3.4.0", "classnames": "^2.5.1", + "copy-webpack-plugin": "^12.0.2", "date-fns": "^2.30.0", "dequal": "^2.0.3", "easymde": "^2.18.0", @@ -59,7 +60,6 @@ "@testing-library/user-event": "^14.5.2", "babel-preset-airbnb": "^5.0.0", "chai": "^4.4.1", - "copy-webpack-plugin": "^12.0.2", "eslint": "^8.57.0", "eslint-config-airbnb": "^19.0.4", "eslint-plugin-import": "^2.29.1", @@ -4945,7 +4945,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", - "dev": true, "engines": { "node": ">=18" }, @@ -8115,7 +8114,6 @@ "version": "12.0.2", "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-12.0.2.tgz", "integrity": "sha512-SNwdBeHyII+rWvee/bTnAYyO8vfVdcSTud4EIb6jcZ8inLeWucJE0DnxXQBjlQ5zlteuuvooGQy3LIyGxhvlOA==", - "dev": true, "dependencies": { "fast-glob": "^3.3.2", "glob-parent": "^6.0.1", @@ -8139,7 +8137,6 @@ "version": "14.0.1", "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", - "dev": true, "dependencies": { "@sindresorhus/merge-streams": "^2.1.0", "fast-glob": "^3.3.2", @@ -8159,7 +8156,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", - "dev": true, "engines": { "node": ">=12" }, @@ -8171,7 +8167,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", - "dev": true, "engines": { "node": ">=14.16" }, @@ -26603,7 +26598,6 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", - "dev": true, "engines": { "node": ">=18" }, diff --git a/client/package.json b/client/package.json index 4c0a795..a3d0c85 100755 --- a/client/package.json +++ b/client/package.json @@ -61,6 +61,7 @@ "dependencies": { "@juggle/resize-observer": "^3.4.0", "classnames": "^2.5.1", + "copy-webpack-plugin": "^12.0.2", "date-fns": "^2.30.0", "dequal": "^2.0.3", "easymde": "^2.18.0", @@ -112,7 +113,6 @@ "@testing-library/user-event": "^14.5.2", "babel-preset-airbnb": "^5.0.0", "chai": "^4.4.1", - "copy-webpack-plugin": "^12.0.2", "eslint": "^8.57.0", "eslint-config-airbnb": "^19.0.4", "eslint-plugin-import": "^2.29.1", diff --git a/client/public/web.config b/client/public/web.config index 7d5e4b8..ab0cf74 100755 --- a/client/public/web.config +++ b/client/public/web.config @@ -1,17 +1,17 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + From 3f83ccad8c5af6de3fcedc3f50cef41c86e6d2de Mon Sep 17 00:00:00 2001 From: Emmanuel Guyot Date: Sat, 20 Jul 2024 19:54:10 +0200 Subject: [PATCH 3/4] Adjust the web.config to be path independent --- client/.env | 2 +- client/README.md | 3 ++ client/config-overrides.js | 22 +--------- client/package-lock.json | 87 -------------------------------------- client/package.json | 1 - client/public/web.config | 2 +- 6 files changed, 6 insertions(+), 111 deletions(-) diff --git a/client/.env b/client/.env index 1037d0b..0085551 100644 --- a/client/.env +++ b/client/.env @@ -1,4 +1,4 @@ REACT_APP_VERSION=1.20.1 REACT_APP_SERVER_BASE_URL=http://localhost:1337 -PUBLIC_URL=http://localhost:3000/planka/ +PUBLIC_URL=http://localhost/planka-a-moi/ BASE_URL=/planka/ diff --git a/client/README.md b/client/README.md index d1ee58f..c688a4c 100755 --- a/client/README.md +++ b/client/README.md @@ -1 +1,4 @@ # Planka client + +IIS install +The build package for IIS requires URL rewrite module [https://www.iis.net/downloads/microsoft/url-rewrite] diff --git a/client/config-overrides.js b/client/config-overrides.js index 115e75a..e696b19 100644 --- a/client/config-overrides.js +++ b/client/config-overrides.js @@ -1,6 +1,5 @@ const fs = require('fs'); const path = require('path'); -const CopyPlugin = require('copy-webpack-plugin'); const BASE_URL_PLACEHOLDER = 'BASE_URL_PLACEHOLDER'; @@ -52,26 +51,7 @@ module.exports = function override(config, env) { return { ...config, output: { ...config.output, publicPath: BASE_URL_PLACEHOLDER }, - plugins: [ - ...plugins, - { apply: replaceBaseUrl }, - new CopyPlugin({ - patterns: [ - { - from: 'public/web.config', - transform: { - transformer(content, absoluteFrom) { - const PUBLIC_PATH = process.env.PUBLIC_URL.replace( - /^.*\/\/[^/]*(.*)[^?#]*.*$/, - '$1', - ); - return content.toString().replaceAll(BASE_URL_PLACEHOLDER, PUBLIC_PATH); - }, - }, - }, - ], - }), - ], + plugins: [...plugins, { apply: replaceBaseUrl }], }; } return config; diff --git a/client/package-lock.json b/client/package-lock.json index 88cd956..0e5d8a6 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -8,7 +8,6 @@ "dependencies": { "@juggle/resize-observer": "^3.4.0", "classnames": "^2.5.1", - "copy-webpack-plugin": "^12.0.2", "date-fns": "^2.30.0", "dequal": "^2.0.3", "easymde": "^2.18.0", @@ -4941,17 +4940,6 @@ "optional": true, "peer": true }, - "node_modules/@sindresorhus/merge-streams": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", - "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/@sinonjs/commons": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", @@ -8110,70 +8098,6 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, - "node_modules/copy-webpack-plugin": { - "version": "12.0.2", - "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-12.0.2.tgz", - "integrity": "sha512-SNwdBeHyII+rWvee/bTnAYyO8vfVdcSTud4EIb6jcZ8inLeWucJE0DnxXQBjlQ5zlteuuvooGQy3LIyGxhvlOA==", - "dependencies": { - "fast-glob": "^3.3.2", - "glob-parent": "^6.0.1", - "globby": "^14.0.0", - "normalize-path": "^3.0.0", - "schema-utils": "^4.2.0", - "serialize-javascript": "^6.0.2" - }, - "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.1.0" - } - }, - "node_modules/copy-webpack-plugin/node_modules/globby": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.1.tgz", - "integrity": "sha512-jOMLD2Z7MAhyG8aJpNOpmziMOP4rPLcc95oQPKXBazW82z+CEgPFBQvEpRUa1KeIMUJo4Wsm+q6uzO/Q/4BksQ==", - "dependencies": { - "@sindresorhus/merge-streams": "^2.1.0", - "fast-glob": "^3.3.2", - "ignore": "^5.2.4", - "path-type": "^5.0.0", - "slash": "^5.1.0", - "unicorn-magic": "^0.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/copy-webpack-plugin/node_modules/path-type": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", - "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/copy-webpack-plugin/node_modules/slash": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", - "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/core-js": { "version": "3.37.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.37.1.tgz", @@ -26594,17 +26518,6 @@ "node": ">=4" } }, - "node_modules/unicorn-magic": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", - "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/unified": { "version": "10.1.2", "resolved": "https://registry.npmjs.org/unified/-/unified-10.1.2.tgz", diff --git a/client/package.json b/client/package.json index a3d0c85..7e975a5 100755 --- a/client/package.json +++ b/client/package.json @@ -61,7 +61,6 @@ "dependencies": { "@juggle/resize-observer": "^3.4.0", "classnames": "^2.5.1", - "copy-webpack-plugin": "^12.0.2", "date-fns": "^2.30.0", "dequal": "^2.0.3", "easymde": "^2.18.0", diff --git a/client/public/web.config b/client/public/web.config index ab0cf74..860380b 100755 --- a/client/public/web.config +++ b/client/public/web.config @@ -9,7 +9,7 @@ - + From 7e0a1974d98ee8b4c9e11911aca74634749b441a Mon Sep 17 00:00:00 2001 From: Emmanuel Guyot Date: Thu, 25 Jul 2024 09:49:07 +0200 Subject: [PATCH 4/4] Specific build for IIS and Apache --- client/README.md | 9 +++++++-- client/config-overrides.js | 10 +++++++++- client/package.json | 2 ++ client/public/.htaccess | 7 +++++++ 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 client/public/.htaccess diff --git a/client/README.md b/client/README.md index c688a4c..02fccb6 100755 --- a/client/README.md +++ b/client/README.md @@ -1,4 +1,9 @@ # Planka client -IIS install -The build package for IIS requires URL rewrite module [https://www.iis.net/downloads/microsoft/url-rewrite] +## IIS install +The build package for IIS requires URL rewrite module https://www.iis.net/downloads/microsoft/url-rewrite +The web.config file is provided as is and should be enough. You might have to modify it to suit your needs. + +## Apache install +The build package for Apache requires mod_rewrite module https://httpd.apache.org/docs/2.4/fr/mod/mod_rewrite.html +The .htaccess file is provided as is and should be enough. You might have to modify it to suit your needs. diff --git a/client/config-overrides.js b/client/config-overrides.js index e696b19..80956a5 100644 --- a/client/config-overrides.js +++ b/client/config-overrides.js @@ -32,7 +32,15 @@ const replaceBaseUrl = (compiler) => { replaceInFile(info.targetPath, `"${BASE_URL_PLACEHOLDER}"`, '`${window.BASE_URL}/`'); } else if (/index\.html$/.exec(info.targetPath)) { // For the main html file, we set a placeholder for sails to inject the correct value as runtime - replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, process.env.PUBLIC_URL); + if (process.argv.indexOf('--IIS') >= 0 || process.argv.indexOf('--APACHE') >= 0) { + if (process.env.PUBLIC_URL === undefined) { + // eslint-disable-next-line no-console + throw new Error('You have to define PUBLIC_URL in .env!'); + } + replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, process.env.PUBLIC_URL); + } else { + replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, '<%= BASE_URL %>'); + } } } }); diff --git a/client/package.json b/client/package.json index 7e975a5..6b1a249 100755 --- a/client/package.json +++ b/client/package.json @@ -3,6 +3,8 @@ "private": true, "scripts": { "build": "react-app-rewired build", + "build:iis": "react-app-rewired build --IIS", + "build:apache": "react-app-rewired build --APACHE", "eject": "react-scripts eject", "lint": "eslint --ext js,jsx src config-overrides.js", "start": "react-app-rewired start", diff --git a/client/public/.htaccess b/client/public/.htaccess new file mode 100644 index 0000000..67e22dd --- /dev/null +++ b/client/public/.htaccess @@ -0,0 +1,7 @@ +Options -MultiViews + + + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^ index.html [QSA,L] +