-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(react): add options to opt out of calling applyPolyfills/defineCustomElements by default #13
feat(react): add options to opt out of calling applyPolyfills/defineCustomElements by default #13
Conversation
…ustomElements by default chore(): update to current @stencil/core version chore(react): update to current @types/jest and jest version
Just hit an issue when working with a Gatsby project. This PR would help resolve issues where apps try to do SSR. |
@jagreehal were you able to get past the Gatsby SSR issue without this code being merged? I am trying to build my Gatsby app using the React version of my Stencil library and getting |
@bellindj I'll upload my repo but Gatsby SSR isn't going to work because replaceRenderer isn't async, and don't think it ever will be see gatsbyjs/gatsby#2423 |
@jagreehal thanks! I was able to get this to work in my Gatsby site as is by using the react-loadable package. I created a new file (dynamic-components.js) in Gatsby with an import for each one of my components:
Then inside my Gatsby components, import from the dynamic components file: This passes SSR for Gatsby and I am off and rolling using my new React lib wrapping my Stencil web components! |
@bellindj with |
@ediabal Yes with react-loadable we were able to load our StencilJS components in our Gatsby site. Unfortunately react-loadable broke our site in IE11/Edge so we decided to strip out Gatsby and just use pure React. With pure React there is no need to react-loadable since it doesn't use SSR out of the box. |
This PR is a bit out of date now. Appologizes for not reviewing earlier. I get the gist of it to allow for more configuration to the loading process for polyfills and autoloading which I agree with. I will likely open another PR to fix and reference this one. |
This was completed in another PR #62. |
Hi again,
as we'd like to let the users of our components decide if and which polyfills they'd like to use, it would be great if we could make the
applyPolyfills().then(() => defineCustomElements(window))
-line optional/configurable.I added 2 options to the reactOutputTarget
noAutoPolyfills
andnoAutoRegister
that will disable the corresponding function call.