简体   繁体   English

在`npm run build`之后可编辑的配置文件

[英]Config files editable after `npm run build`

I'm deploying a web app using react-redux soon and I was wondering if it was possible to let the user using the production version to modify a config file so that he can set his own initial settings. 我即将使用react-redux部署一个Web应用程序,我想知道是否可以让使用生产版本的用户修改配置文件,以便他可以设置自己的初始设置。

Is it possible, after I run npm run build , to have a config.js file in the build folder that the user can go and directly modify? 在运行npm run build ,是否可以在build文件夹中拥有一个config.js文件,用户可以直接对其进行修改?

If not, is there any better way to accomplish that using another strategy? 如果没有,是否有更好的方法使用另一种策略来实现?

Thank you 谢谢

If I understand correct you want to expose a API to change some of settings in config for end user and then somehow restart your API servers to apply those changes. 如果我理解正确,那么您想公开一个API来为最终用户更改config中的某些设置,然后以某种方式重新启动API服务器以应用这些更改。

Always a dangerous way of doing things. 始终是一种危险的处事方式。 You can expose functionality to change few of fields of config for end user and when applied restart the node process. 您可以公开功能来更改最终用户的config的几个字段,并在应用后重新启动节点进程。 There are few ways to restart node process from code itself or writing a hot script which monitors changes in source directory. 有几种方法可以从代码本身重新启动节点进程或编写监视源目录更改的热脚本。

But beware its risky thing to do. 但是要当心它的冒险行为。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM