serve icon indicating copy to clipboard operation
serve copied to clipboard

Why are the source code and node_modules served ?

Open harvey56 opened this issue 5 years ago • 2 comments

I use CRA ([email protected]). If I serve my app locally, so using webpack devserver, I have the expected files served.

However, if I serve my build folder, with a npm run build, followed by a serve -s build, I have the following files served :

  • static/
    • css/
    • js /
    • media/
    • node_modules/
  • path/to/my/local/source/code
    • node_modules
    • src

My build folder is at the root, and contains all the files and folders I am expecting to see.

BTW, I use firebase hosting to deploy my app. And I see the same file structure in my deployed app.

Any clue what I'm missing here ?

harvey56 avatar Mar 25 '20 04:03 harvey56

@harvey56 I'm having the same issue too. Did you manage to solve the issue?

EDIT: I just managed to solve this. You just have to add GENERATE_SOURCEMAP=false in your .env file (it is only used in production)

hielfx avatar Dec 22 '20 09:12 hielfx

Oops! sorry for the late reply @hielfx

Yes, that's what I do. I added GENERATE_SOURCEMAP=false in my script in my package.json file.

harvey56 avatar Apr 07 '21 06:04 harvey56