Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-compiled source code ( pre-minified ) can be seen on Chrome Sources #1600

Closed
gijonc opened this issue Apr 13, 2018 · 4 comments
Closed

Comments

@gijonc
Copy link

gijonc commented Apr 13, 2018

So I have tried to use yarn run build -- --release to build my app on my EC2 instance (Ubuntu) using Nginx web server , while I ran node server.js I know it's running on my server and I can browse the page from my domain, but I can also inspect all the source code that are unminimized (from my server root path), I inspected using Chrome.

screen shot 2018-04-13 at 11 56 27 am

I supposed this is a release version, shouldn't all js source code have been optimized and minimized after running the build command?

@tim-soft
Copy link

Are you referring to source maps?

@gijonc
Copy link
Author

gijonc commented Apr 13, 2018

Not only the source maps, I can clearly see all the unminimized source code

screen shot 2018-04-13 at 12 20 51 pm

@gijonc gijonc changed the title Pre-compiled source code (unminimized) can be seen on Chrome Sources Pre-compiled source code ( pre-minified ) can be seen on Chrome Sources Apr 14, 2018
@gijonc
Copy link
Author

gijonc commented Apr 14, 2018

@gijonc gijonc closed this as completed Apr 14, 2018
@hackhat
Copy link

hackhat commented May 26, 2018

You can use GENERATE_SOURCEMAP environment variable. Not sure why this issue has been closed without a solution, but here is a way.

In the docs of react-starter:

Variable Development Production Usage
BROWSER By default, Create React App will open the default system browser, favoring Chrome on macOS. Specify a browser to override this behavior, or set it to none to disable it completely. If you need to customize the way the browser is launched, you can specify a node script instead. Any arguments passed to npm start will also be passed to this script, and the url where your app is served will be the last argument. Your script's file name must have the .js extension.
HOST By default, the development web server binds to localhost. You may use this variable to specify a different host.
PORT By default, the development web server will attempt to listen on port 3000 or prompt you to attempt the next available port. You may use this variable to specify a different port.
HTTPS When set to true, Create React App will run the development server in https mode.
PUBLIC_URL Create React App assumes your application is hosted at the serving web server's root or a subpath as specified in package.json (homepage). Normally, Create React App ignores the hostname. You may use this variable to force assets to be referenced verbatim to the url you provide (hostname included). This may be particularly useful when using a CDN to host your application.
CI 🔶 When set to true, Create React App treats warnings as failures in the build. It also makes the test runner non-watching. Most CIs set this flag by default.
REACT_EDITOR When an app crashes in development, you will see an error overlay with clickable stack trace. When you click on it, Create React App will try to determine the editor you are using based on currently running processes, and open the relevant source file. You can send a pull request to detect your editor of choice. Setting this environment variable overrides the automatic detection. If you do it, make sure your systems PATH environment variable points to your editor’s bin folder.
CHOKIDAR_USEPOLLING When set to true, the watcher runs in polling mode, as necessary inside a VM. Use this option if npm start isn't detecting changes.
GENERATE_SOURCEMAP When set to false, source maps are not generated for a production build. This solves OOM issues on some smaller machines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants