Gatsby: [v2] --no-uglify no longer implemented

Created on 9 Aug 2018  ·  5Comments  ·  Source: gatsbyjs/gatsby

Description

I've noticed that gatsby build --noUglify still uglifies the code in V2. After digging around a little, it seems that noUglify is only referenced in build.js. Previously, noUglify was referenced in both babel-config.js and webpack.config.js.

Steps to reproduce

Run gatsby build --noUglify and see that code is still uglified.

Expected result

Code should not be uglified

Actual result

Code was uglified

Environment

❯ npx gatsby info --clipboard

  System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    Shell: 5.5.1 - /usr/local/bin/zsh
  Binaries:
    Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
    Yarn: 1.9.4 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
  Browsers:
    Chrome: 68.0.3440.106
    Firefox: 61.0.1
    Safari: 11.1.2
  npmPackages:
    gatsby: next => 2.0.0-beta.83

File contents (if changed)

gatsby-config.js: N/A
package.json: N/A
gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

bug

Most helpful comment

Thank you @tryzniak!

All 5 comments

Indeed. Would love to work on this bug.

@danoc thanks for reporting this! --no-uglify was added to v1 I believe after v2 was well under way and never got merged it seems into v2.

@tryzniak would love a PR!

Oh actually the reason is you disable minimization in v4 of webpack differently — see this stackoverflow post https://stackoverflow.com/questions/51263506/webpack-4-disable-uglifyjs-webpack-plugin

Someone want to implement this? It'd be a nice way to get a first PR done.

The setting would go here https://github.com/gatsbyjs/gatsby/blob/a0e64208b6cf0068c1c61eabef134173bb911f44/packages/gatsby/src/utils/webpack.config.js#L424

The program variable has what the different flags are.

We _might_ have to disable our uglify plugin as well but it might be that webpack handles disabling that for us by setting minimize to false.

Yeah, I'm on it! Thank you for the nudge in the right direction!

Thank you @tryzniak!

Was this page helpful?
0 / 5 - 0 ratings