I was trying today to get a certain build plugin only “activating” on a branch deploy/deploy preview (i.e. not in the “production” build). However, because all examples for
netlify.toml build plugins shows it as a “global” thing I have had to “work out” the toml for myself. I think I have it right, but both
netlify build --dry --context=branch-deploy and a proper branch push deploy log don’t show my plugin being used. If I use the “standard”
[[plugins]] section name I can see it in the build dry run output.
netlify.toml I have crafted:
[[context.branch-deploy.plugins]] package = "my-plugin-name-here" [context.branch-deploy.plugins.inputs] inputOne = "xxxxx" secondInput = "yyyyy" [[context.deploy-preview.plugins]] package = "my-plugin-name-here" [context.deploy-preview.plugins.inputs] inputOne = "xxxxx" secondInput = "yyyyy"
Upon further digging, I have a feeling that this is because
[[plugins]] is “global” in the
netlify.toml file, but when you use
[context.xxxxx.some-key] you’re actually setting the key as if it were inside the global
[build] section in the
netlify.toml file. Is that right?
Either way, is there a way to use a build plugin in one context but not another? Or use it in all, but specify different inputs depending on context?