Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For a React app, can the build process not create a JavaScript map file?

Tags:

reactjs

If an app is created using React's official create-react-app hello-world, and building it with npm run build, I often do:

npm run build && rm -f build/static/js/*.js.map 

because when the files are transferred to the server using sftp, I just use

put -r .

to put everything there, and the js.map file is huge, like 2.7MB for a small project.

It also takes time to build it too, so instead of building it and removing it, is there a way to just not build it?

like image 320
nonopolarity Avatar asked Apr 04 '17 15:04

nonopolarity


People also ask

Is react build on JavaScript?

What Is React? React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It lets you compose complex UIs from small and isolated pieces of code called “components”.

How do I enable source map in Create react app?

In the inspection tool, click on the gear icon on the very top right of the window to open the settings page as shown below. In the preference tab, under the Sources subheader, make sure that Enable JavaScript source maps is enabled.

What is map file react?

In React, the map() function is most commonly used for rendering a list of data to the DOM.


1 Answers

For anyone coming to this question in 2018 and later :

Add the following line in a .env file at the root of your project.

GENERATE_SOURCEMAP = false
like image 186
Ahmad Maleki Avatar answered Oct 06 '22 00:10

Ahmad Maleki