Parcel build exposes source

Hi in condescending-keller-8bf902.netlify.app

I am trying a parcel (package.json) app.
It works like charm BUT… it exposes the source code.
I like the build would (1) get my git repo as is (2) run the build and copy the dist/ contents into the root folder together with the source.

I would like the build (dist/) to be the only thing exposed/published or alternatively to delete the sources after the app is built.

How can that be done?

Currently my build command is parcel build index.html --public-url ./
and my publish dir is dist

Thanks in advance.

If your output folder is dist and it contains only your output and no source, then having it set as the Publish directory should be all you need to do.

Only the files in the Publish directory are deployed to the cdn.

When I access your site I don’t see any obvious source code… but my computer does grind to a halt, presumably due to the fancy animated ocean! :slightly_smiling_face:

Thanks Nathan for the fast reply.

On the code exposure front. What browser do you use? I’ve seen this happening in other webs in netlify. When you go to the source code part you see both the minifed/uglified version of dist/ and the plain one. I see it on the “sources” part of chrome when I hit f12 or in the debug part in firefox.

On the computer halt, what CPU and RAM do you have? does the web completely block it? :open_mouth:

BR
Hector

I looked at your site in Chrome on a 2015 Macbook Pro, for which it’s so intensive it basically crashes the browser. Looking at it in Chrome on my gaming PC (rtx 2070 super) it runs fine.

In regards to the source being visible in the devtools, that isn’t a Netlify feature, it’s occuring due to a Source Map (which you can see when you mouse over it, it says “index.js (from source map)”).

You can see there is a build flag of --no-source-maps here to disable it:

3 Likes

Thanks @nathanmartin , you saved my day!
Very much appreciated. (For future reference, I had to delete/clean the cache)

2 Likes