gatsby: Unknown argument: uglify
PR #4755 introduced a --no-uglify flag but it doesn’t work for me when invoked from an npm script or via npx:
$ npx gatsby build --no-uglify
node_modules\gatsby\dist\bin\gatsby.js build
Options:
-h, --help Show help
--verbose Turn on verbose output
--no-color Turn off the color in output
--prefix-paths Build site with link paths prefixed (set prefix in your config).
--no-uglify Build site without uglifying JS bundles (for debugging).
-v, --version Show version number
Unknown argument: uglify
As a workaround, it is possible to do
$ npx gatsby build --noUglify
or
{
"scripts": {
"build": "gatsby build --noUglify"
}
}
Note: I previously made it sound like the CLI parsing is incorrect but doing $ gatsby build --no-uglify (using global gatsby-cli) works correctly. Sorry!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 29 (29 by maintainers)
Commits related to this issue
- Demo for gatsbyjs/gatsby#4820 — committed to borekb/gatsby-issue-4820-demo by borekb 6 years ago
Oh I just realized something – thanks, @pieh! An important detail in the OP, and also my miscommunication (sorry!) is that I’m actually running
gatsby buildfrom apackage.jsonso Gatsby used is local. That probably makes a difference. These are exactly the things I can do, now:Note how
--noUglifyworks but--no-uglifydoesn’t so it’s still likely a Gatsby issue, I would think.I’m able to reproduce this on my mac if that helps:
Does the same thing when run by NPM:
If there’s any info I can give you guys about my setup I’m happy to.
@borekb you can check merge commit and see tags on github - it was added in gatsby@1.9.244 and gatsby-cli@1.1.50