Build: How to write plugin config in TOML format?

Created on 18 Oct 2019  ยท  3Comments  ยท  Source: netlify/build

Maybe I am not understanding something, but trying to use both netlify dev and netlify build - seems netlify dev wants me to use netlify.toml configuration file. This is my file

[build]
  # folder to publish with static content
  # since we have a "simple" static site, we can directly publish "src" folder
  publish = "src"

[[plugins]]
name = "Cypress"
type = "netlify-plugin-cypress"
[config]
  # if we are running the example site locally
  # then it will be at local port
  baseUrl = 'http://localhost:8080'

But the plugin name is not resolved correctly

$ netlify build --dry
โฏ Loading plugins
  Loading plugin "0" from netlify-plugin-cypress
  Loading plugin "@netlify/functions" from build core
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” 
  โ”‚ 1. functionsBuild โ†“ โ”‚  Plugin @netlify/functions in build core
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ 
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” 
  โ”‚ 2. postBuild        โ”‚  Plugin 0 netlify-plugin-cypress
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ 

which is weird

question

Most helpful comment

Plugin formats have been updated to an array like so:

build:
  publish: src
plugins:
  - type: netlify-plugin-cypress
    config:
      baseUrl: http://localhost:8080

And in toml it looks like

[build]
publish = "src"

[[plugins]]
type = "netlify-plugin-cypress"

  [plugins.config]
  baseUrl = "http://localhost:8080"

All 3 comments

Hi @bahmutov,

The netlify.toml has some TOML syntax errors. The netlify.toml should be:

[build]
  # folder to publish with static content
  # since we have a "simple" static site, we can directly publish "src" folder
  publish = "src"

[plugins.Cypress]
type = "netlify-plugin-cypress"
[plugins.Cypress.config]
  # if we are running the example site locally
  # then it will be at local port
  baseUrl = 'http://localhost:8080'

which is the same as the following YAML:

build:
  publish: src
plugins:
  Cypress:
    type: netlify-plugin-cypress
    config:
      baseUrl: http://localhost:8080

Does the file work?

We recommend using YAML as TOML can be confusing.

We will add some validation for the configuration file (#38) which should help you fix those errors better in the future.

Plugin formats have been updated to an array like so:

build:
  publish: src
plugins:
  - type: netlify-plugin-cypress
    config:
      baseUrl: http://localhost:8080

And in toml it looks like

[build]
publish = "src"

[[plugins]]
type = "netlify-plugin-cypress"

  [plugins.config]
  baseUrl = "http://localhost:8080"

Closing this issue. Feel free to re-open if you have more issues/questions on the syntax

Was this page helpful?
0 / 5 - 0 ratings