Module Export Syntax

When exporting functions in the following files, we recommend you use the standard export syntax contained in the documentation's code examples:

You can also use other export formats that are part of the ES6 (ES2015) module export syntax. However, the following export formats are not supported in events.js, data.js, routers.js, or service plugin code files:

  • Re-exporting a function: Directly re-exporting a function imported from an npm or Velo package. For example, this doesn't work:

    Copy
    1

    The following alternative syntax is supported:

    Copy
    1
  • Dynamic exports: Exports including a dynamic operation or expression that requires execution to resolve. For example, this doesn't work:

    Copy
    1

    The following alternative syntax is supported:

    Copy
    1
  • Exports wrapped in objects: Exports where functions are defined as properties of an object. For example, this doesn't work:

    Copy
    1

    The following alternative syntax is supported:

    Copy
    1
  • CommonJS exports: Exports in the CommonJS (CJS) format that preceded ES6 (ES2015). For example, this doesn't work:

    Copy
    1

Functions exported using a syntax that isn't supported aren't called by the triggering event.

Was this helpful?
Yes
No