ASP.NET Core React.js 应用程序在发布到 Azure 后会暴露其源代码。

huangapple go评论63阅读模式
英文:

ASP.NET Core React.js app exposes its source code after being published to Azure

问题

我正在将使用 ASP.NET Core React.js 模板创建的应用发布到 Azure App Service。但是,在发布后,我可以在浏览器中看到所有的源代码,没有任何混淆或其他保护措施。我没有对设置进行任何更改,因为它是模板中的纯代码。

ASP.NET Core React.js 应用程序在发布到 Azure 后会暴露其源代码。

有人知道发生了什么问题以及我做错了什么吗?提前感谢您!

我已经阅读了微软的文档并尝试寻找解决方案,但迄今为止都没有帮助。

英文:

I'm publishing an app created using the ASP.NET Core React.js template to Azure App Service. However, after publishing, I can see all the source code in the browser without any obfuscation or other protective measures. I haven't made any changes to the settings, as it's a pure code from the template.

ASP.NET Core React.js 应用程序在发布到 Azure 后会暴露其源代码。

Does anyone know what's going on and what I'm doing wrong? Thanks in advance!

I have read the documentation from Microsoft and have tried searching for a solution to the problem, but nothing has helped so far.

答案1

得分: 1

我找到了答案并感谢大家的回答。

问题出在'js map'文件中。为了解决问题,只需将GENERATE_SOURCEMAP=false添加到你的**.env**文件中。

要获取更多信息,你可以阅读这篇文章:https://izhan-yameen25.medium.com/protect-your-react-js-source-code-in-production-build-e6b408003817

英文:

I found the answer to my question and thank you all for your answers.

The problem was in the 'js map' files. To solve the problem, you just need to add

GENERATE_SOURCEMAP=false to your .env file.

For more information, you can read this article : https://izhan-yameen25.medium.com/protect-your-react-js-source-code-in-production-build-e6b408003817

答案2

得分: 0

JavaScript是在客户端运行的语言,因此代码将可见,但有方法可以捆绑和缩小代码,使其更小,从而提高性能,这也在一定程度上混淆了代码,但代码始终以某种方式可用。

有关捆绑和缩小的更多信息,请查看这里:
https://learn.microsoft.com/en-us/aspnet/core/client-side/bundling-and-minification?view=aspnetcore-7.0

英文:

Javascript is a language that is run on the client, so the code will be visible, however there are ways to bundle and minify the code so its smaller in size, which increases performance, this also obfuscates the code to a degree, but the code will always be available somehow.

see more on bundling and minification here:
https://learn.microsoft.com/en-us/aspnet/core/client-side/bundling-and-minification?view=aspnetcore-7.0

huangapple
  • 本文由 发表于 2023年6月13日 16:15:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76462933.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定