yinxin630 / fiora

An interesting open source chat application. Developed with node.js, mongoDB, socket.io and react
https://fiora.suisuijiang.com
MIT License
6.57k stars 1.31k forks source link

修改客户端配置后重新构建客户端仍无效 #391

Closed 52lemon6 closed 3 years ago

52lemon6 commented 3 years ago

docker环境下在/uer/app/fiora目录下新建 .env 文件

MaxGroupCount=3 Administrator=60bd89ae03915e0026fe30d1 MaxImageSize=90971520 MaxFileSize=50485760

image 重新构建客户端和重启容器后客户端配置参数仍无效 (如不能上传超过默认大小的图片和文件,但管理员账户和创建最大的群数正常)

重构客户端的日志

root@fc73144419de:/usr/app/fiora# yarn build:client && yarn move-dist yarn run v1.22.5 $ rm -rf dist && cross-env NODE_ENV=production webpack --config build/webpack.prod.js

● Webpack █████████████████████████ emitting (95%) emit

● Webpack █████████████████████████ done (99%) plugins

✔ Webpack Compiled successfully in 1.72m Browserslist: caniuse-lite is outdated. Please run:npx browserslist@latest --update-db Why you should do it regularly:https://github.com/browserslist/browserslist#browsers-data-updating @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to true, as the next major version will default this option to true. (node:92) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated. BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation. Do changes to assets earlier, e. g. in Compilation.hooks.processAssets. Make sure to select an appropriate stage from Compilation.PROCESS_ASSETSSTAGE. (Use node --trace-deprecation ... to show where the warning was created) [webpack-cli] Compilation finished assets by chunk 1.67 MiB (auxiliary name: app) assets by path .jpeg 186 KiB 27 assets assets by path .gif 802 KiB 7 assets assets by path .jpg 496 KiB 6 assets assets by path .mp3 124 KiB 6 assets assets by path .png 89.3 KiB 4 assets asset font.dd5c1cd6.woff 16.9 KiB [emitted] [immutable] [from: client/assets/fonts/font.woff] (auxiliary name: app) assets by path .js 3.73 MiB assets by info 3.71 MiB [immutable] assets by chunk 2.3 MiB (id hint: vendors) 18 assets 12 assets asset workbox-0d8277e8.js 13.7 KiB [emitted] [minimized] asset service-worker.js 4.33 KiB [emitted] [minimized] asset index.html 1.3 KiB [emitted] orphan modules 989 KiB [orphan] 459 modules runtime modules 8.25 KiB 14 modules modules by path ./node_modules/ 6.24 MiB 834 modules modules by path ./client/ 604 KiB 51 modules modules by path ./utils/ 25.8 KiB modules by path ./utils/.ts 21 KiB 10 modules ./utils/convertMessage.ts + 1 modules 1.55 KiB [built] [code generated] ./utils/playSound.ts + 6 modules 3.17 KiB [built] [code generated] modules by path ./.linaria-cache/client/ 5.99 KiB modules by path ./.linaria-cache/client/modules/Chat/ 4.24 KiB 8 modules modules by path ./.linaria-cache/client/.css 746 bytes 2 modules modules by path ./.linaria-cache/client/components/.css 1.02 KiB 2 modules ./config/client.ts 1.12 KiB [built] [code generated] ws (ignored) 15 bytes [optional] [built] [code generated]

LOG from GenerateSW The service worker at service-worker.js will precache 81 URLs, totaling 5.65 MB.

WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). This can impact web performance. Assets: background.b89fc124.jpg (274 KiB) wuzeiniang.42efbfde.gif (488 KiB) app.db107c7a.js (1.34 MiB) react-ace-mode-php.de884add.js (461 KiB) 832.9a796752.js (253 KiB) 210.7b0ee0be.js (539 KiB)

WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. Entrypoints: app (1.34 MiB) app.db107c7a.js

webpack 5.4.0 compiled with 2 warnings in 101740 ms Done in 108.64s. yarn run v1.22.5 $ mv -f dist/fiora/* public Done in 0.14s.

yinxin630 commented 3 years ago

晚上我试一下

yinxin630 commented 3 years ago

image

实测是生效的, 如图通过 .env 文件将值修改为 100kb, 然后重新 build client, 刷新页面即生效

yinxin630 commented 3 years ago

看你的描述中 backend config 是生效了的, 那么检查一下前端是否有缓存吧.

可以看一下服务器上最新的 index.html 内容和实际请求到的是否相符