Skip to content

Commit

Permalink
docs(output-target): custom elements auto-define export behavior (#916)
Browse files Browse the repository at this point in the history
This commit updates `autoDefineCustomElements` from being a standalone config flag to an option on `customElementsExportBehavior`. This commit is associated with ionic-team/stencil#3615
  • Loading branch information
tanner-reits committed Sep 19, 2022
1 parent c6be6ef commit 88dda69
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/docs/output-targets/custom-elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,19 @@ export const config: Config = {
outputTargets: [
{
type: 'dist-custom-elements',
customElementsExportBehavior: 'default' | 'single-export-module',
customElementsExportBehavior: 'default' | 'auto-define-custom-elements' | 'single-export-module',
},
// ...
],
// ...
};
```

| Option | Description |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `default` | No additional re-export or auto-definition behavior will be performed.<br><br>This value will be used if no explicit value is set in the config, or if a given value is not a valid option. |
| `single-export-module` | All component and custom element definition helper functions will be exported from the `index.js` file in the output directory (see [Defining Exported Custom Elements](#defining-exported-custom-elements) for more information on this file's purpose). This file can be used as the root module when distributing your component library, see [below](#distributing-custom-elements) for more details. |

<!-- TODO(STENCIL-457): Move this info to the appropriate option on `customElementsExportBehavior` -->

### autoDefineCustomElements

By default, consumers of the `dist-custom-elements` output target need to
register each Stencil component that they want to use in the bundle manually.
Setting this flag to `true` will define a component automatically with the
`CustomElementRegistry` when the component's module is imported. Note that this
will also automatically recursively define any child components as well.

This flag defaults to `false` when omitted from a Stencil configuration file.
| Option | Description |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `default` | No additional re-export or auto-definition behavior will be performed.<br><br>This value will be used if no explicit value is set in the config, or if a given value is not a valid option. |
| `auto-define-custom-elements` | A component and its children will be automatically defined with the `CustomElementRegistry` when the component's module is imported. |
| `single-export-module` | All component and custom element definition helper functions will be exported from the `index.js` file in the output directory (see [Defining Exported Custom Elements](#defining-exported-custom-elements) for more information on this file's purpose). This file can be used as the root module when distributing your component library, see [below](#distributing-custom-elements) for more details. |

> Note: At this time, components created not using JSX may not be automatically
> defined. This is a known limitation of the API and users should be aware of
Expand Down

0 comments on commit 88dda69

Please sign in to comment.