enhance-dev / enhance-ssr

Server side render for custom elements.
140 stars 9 forks source link

Add exceptions collection #19

Closed kristoferjoseph closed 2 years ago

kristoferjoseph commented 2 years ago

When enhance renders it looks for the backing server template for every custom element on the page in the elements collection. If no element definition is found it throws an error.

We need to add an exceptions collection to support a case where there are custom elements on the page that you do not want enhance to try to expand.

Proposed enhancement:

const html = enhance({
  elements: {
    'enhance-header': EnhanceHeader
  },
  exceptions: [
    'random-element'
  ]
})
kristoferjoseph commented 2 years ago

OR we could console.warn instead of throwing, which might be the correct thing to do in order to cut down on the amount of work the user has to do.