`netlify-build` versus `netlify build`

What is the difference between netlify-build and netlify build ?

Not sure what netlify-build is. What context did you see it in?

netlify build is the command that runs a build locally for you from our CLI: Get started with Netlify CLI | Netlify Docs

The template for Netlify Build Plugins:

from
@ehmicky

The package.js mentions:

npx netlify-build does seem to work similarly to npx netlify build except some of the Git/Netlify environment variables don’t have values all the time as expected.

ah, yes, netlify-build is the command line utility that npm install -g @netlify/build installs. Thanks for the clue - I’m not a build plugins expert yet :slight_smile:

netlify build uses our CLI instead as I linked before. No surprise that using it works better than calling the npm module’s specific CLI directly, since that is the intended use path.

I can confirm what @fool is outlining.

Both netlify-build (@netlify/build binary) and netlify build (Netlify CLI command that calls @netlify/build programmatically) should behave pretty similarly. However netlify-build is only meant for internal testing purpose. netlify build also finds your Netlify authentication token (added by netlify login) and site ID (added by netlify link), which helps you use the build settings you might have set in the Netlify app (such as environment variables). It is the recommended approach.

Note that the build-plugin-template is unfortunately outdated in several places. We are working on updating it.