Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Question: How to author standalone components? #110

Closed
jacobmischka opened this issue Jan 30, 2018 · 2 comments
Closed

Question: How to author standalone components? #110

jacobmischka opened this issue Jan 30, 2018 · 2 comments

Comments

@jacobmischka
Copy link

jacobmischka commented Jan 30, 2018

This is technically more of a general Svelte issue, but I feel it's particularly relevant to Sapper so I opened it here. Please let me know if I should move it to the svelte repo instead.

Sapper using both generate: 'ssr' on the server and hydrate: true on the client means that I'm not entirely sure how I'm supposed to publish components that will work out of the box (ie import FeatherIcon from 'svelte-feather-icon';).

"Normal" compiled components (with neither of those options set) work in Sapper when they're dynamic, but anything that's statically rendered (present on the page immediately instead of being dynamically added) will cause an error:

(node:14491) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 11)

Client error (when navigating to page from another route, from hydrate not being set I assume):

TypeError: feathericon._fragment.l is not a function

Server error (when accessing the route directly, from ssr not being enabled I assume):

TypeError: __WEBPACK_IMPORTED_MODULE_3_svelte_feather_icon__.a._render is not a function

Is there any solution besides telling people to import and compile the .html files directly?

@jacobmischka
Copy link
Author

I suppose I could point main to the .html file, but I imagine most people set exclude: /node_modules/ by default in their webpack configs, so I'm not sure if that's a better solution.

@jacobmischka
Copy link
Author

Actually nevermind, closing in favor of sveltejs/svelte#604.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant