[英]React source code exposed in AWS amplify deployment
I am testing deployment of an app on AWS amplify.我正在 AWS amplify 上测试应用程序的部署。 These are the steps I followed:
这些是我遵循的步骤:
version: 1
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
The deployment works beautifully, even when I push new changes.即使我推送新的更改,部署也能很好地工作。 The issue is that I can see the entire source code in the Chrome Dev Tools (as shown below).
问题是我可以在 Chrome 开发工具中看到整个源代码(如下所示)。 Any tips on how I can resolve this?
关于如何解决这个问题的任何提示?
by default, create-react-app will generate full sourcemaps:默认情况下,create-react-app 将生成完整的源映射:
A build script to bundle JS, CSS, and images for production, with hashes and sourcemaps.
用于捆绑 JS、CSS 和用于生产的图像的构建脚本,带有散列和源映射。 https://github.com/facebook/create-react-app#whats-included
https://github.com/facebook/create-react-app#whats-included
you can set GENERATE_SOURCEMAP=false
before the build script:您可以在构建脚本之前设置
GENERATE_SOURCEMAP=false
:
build:
commands:
- GENERATE_SOURCEMAP=false yarn run build
you can see it defined in the source code of create-react-app webpack config:您可以在 create-react-app webpack 配置的源代码中看到它定义:
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/webpack.config.js#L43-L46 https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/webpack.config.js#L43-L46
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.