Skip to content
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

[SSR error] environment.setHelperManager is not a function #45

Closed
lifeart opened this issue Oct 17, 2021 · 3 comments
Closed

[SSR error] environment.setHelperManager is not a function #45

lifeart opened this issue Oct 17, 2021 · 3 comments

Comments

@lifeart
Copy link
Contributor

lifeart commented Oct 17, 2021

image

I got this if trying to render glimmerx app in ssr mode:

import { renderToString } from '@glimmerx/ssr';

import App from './App';

export function render() {
    return renderToString(App, {
        rehydrate: true,
    });
}

I see environment resolution problems in SSR mode, especially,

import 'glimmer-apollo/environment-glimmer' not working in nodejs (module not found), looks like it should be bundled to support nodejs execution or such

@lifeart
Copy link
Contributor Author

lifeart commented Oct 17, 2021

@josemarluedke
Copy link
Owner

josemarluedke commented Oct 17, 2021

@lifeart After a bit of trial and error, I saw that Vite is not using conditional exports correctly when doing SSR.

If you change the import to import 'glimmer-apollo/dist/cjs/environment-glimmer';, you will note that for the most part, it will work. After the SSR page is served, then we get the error for the client not finding the module. There were a few issues/prs in Vite around this problem, but they seem to be resolved/closed.

I did find another issue when running in node using Vite, a PR for that is coming: ReferenceError: self is not defined.

@lifeart
Copy link
Contributor Author

lifeart commented Oct 20, 2021

closing, it, proposed solution (straightforward import) works just fine!

@josemarluedke thank you for your findings here and support!

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

No branches or pull requests

2 participants