Minify: The cli doesn't pass in comments: false

Created on 31 Jul 2016  路  12Comments  路  Source: babel/minify

It seems like comments: false cannot passed from the preset nor the cli 馃槙

bug

Most helpful comment

--no-comments works in the cli, but it strips even "strong" comments like those used for licenses (i.e. there's no equivalent to uglify's "some" option).

All 12 comments

Any update on this? It would cleanup bundles when using it instead of UglifyJS.
Example repository for it.

--no-comments works in the cli, but it strips even "strong" comments like those used for licenses (i.e. there's no equivalent to uglify's "some" option).

Thanks, it solved the issue. Finally tree-shaking really works with Webpack + Babel + Babili :+1:

Just curious as I am bound to Webpack where CLI options do not work: Where is the "no-comments" flag implemented? Because Babel actually seems to only know "--comments false" ... at least this is what I see in babel-core/lib/transformation/file/options/config.js

should be able to do

{ "comments": false }

in your .babelrc/query

What would be the resulting .babelrc file? This setup doesn't seem to work.

{
  "presets": ["latest"],
  "comments": false
}

Ok that's weird, it works fine in babel https://github.com/babel/babel/blob/master/package.json#L51

For me, the latest Babili - as of writing - properly removes non-Webpack comments, using this loader config:

{
  test: /\.js$/,
  loader: `babel`,
  query: {
    presets: [`babili`],
    plugins: [`transform-es2015-modules-commonjs`],
    comments: false
  }
}

Not sure if there is a way for Babili to minify the Webpack bundle itself? Perhaps that's why Uglify is a Webpack plugin, and the same might need to be done for Babili.

@brianblakely your wish came true https://github.com/boopathi/babili-webpack-plugin

馃槷

Thanks @boopathi

I believe this is related? https://phabricator.babeljs.io/T6858

a PR with https://github.com/babel/babel/pull/4507

Going to close as dup of https://github.com/babel/babel/issues/3899 since it's Babel issue. Will be out in the next release

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kangax picture kangax  路  4Comments

marvinhagemeister picture marvinhagemeister  路  5Comments

phoxer picture phoxer  路  3Comments

GabbeV picture GabbeV  路  3Comments

developit picture developit  路  5Comments