Code outside publish directory is deployed

Site Link : https://whatsend.netlify.app/

Issue

This website is bootstrapped using create-react-app. A production-ready minified and bundled code is generated in the build folder when the npm run build is run.
I have also specified the Publishing directory as build. But when I inspected the source of my website I found the node_modules folder and the original code I wrote (Not bundled code). Please help me with this? What am I doing wrong?

Deploy Settings

Website Source from Chrome Inspect tool.
image

Hi, I forked your repo and ran the code with no changes, I however, did not have node_modules and it was only compiled code.
image

Please try clearing the cache and deploying :slight_smile:

Thanks for replying. This is not the problem, the build folder will contain only the optimised bundled files. What I am telling about is the code deployed by netlify. After deploying the website I inspected the website using build tools and it contained node_modules.

I tried deploying after clearing cache it did’nt worked.

What I was referring to above is what netlify is serving. When you deploy you can download the files it serves.
image

As far as I can tell I cannot reproduce it, however, I hope someone else is able to assist if your problem still persists.

Okay, I also tried downloading the published code and I couldn’t find the node_modules in it. Can you please check inspecting the website source directly?

Youre serving static files to the web, it needs the dependencies right? :slight_smile: (Im 99% sure the static content needs this)

If it helps, I had checked the sources panel a few minutes after you had posted your question and I couldn’t see the node_modules folder. I was going to type a reply that I can’t see it, but, I thought, I’d let someone more knowledgeable weigh in.

EDIT: However, I can’t say for sure if the folder exists or not, as when I visited https://whatsend.netlify.app/node_modules/, I am not getting a 404. Are you redirecting 404 to your home page? If yes, then you can be sure that there’s no node_modules folder on your website.

1 Like