Parceljs doesn't completely strip comments

162 Views Asked by At

We are using Parceljs v2 for bundling our SPAs.

We've been noticed by our customer's security team that the comments are not completely stripped from the bundles: enter image description here

We use the default settings for Parcel. In the docs is specified that uglify.js is used by default and seems it doesn't do its job.

1

There are 1 best solutions below

0
Ruben Dario On

For Parcel v2 using SWC here's the solution I found removed all comments

In the root of your project, make file .terserrc:

{
  "mangle": true,
  "compress": true,
  "format": {
    "comments": false
  }
}

for more details, check the docs. I find that with Parcel, reading the small print from their official channels is the way to troubleshooting. Aside from that, this bundler truly is magic.