Search code examples
javascriptdeploymentnetlifyparceljs

My project files are shown publicly when deployed by netlify and bundled with parcel config


I have a plain javascript html project for a website. Used parcel to bundle and minimize the html and javascript files. When I run the parcel build command a dist folder is created with [filename].hash.js and [filename].js.map but HTML files stay same. I thought during the deployment netlify will directly take the files generated in the build folder but instead, it shows all the files after deploying.

enter image description here

I would like to know how to hide my javascript files in the website and use only files generated by parcel bundler. Do I need to make any special configuration in the Netlify or Parcel?


Solution

  • We need to disable the source map in the parcel js config or in the build command in the package.json file.

    "scripts": {
        "start": "parcel",
        "build": "parcel build --no-source-maps"
      },
    

    And make sure to use "npm run build" as a build command in the netlify.