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

Prerender not finding window properties #1036

Closed
threeaccents opened this issue Aug 23, 2018 · 4 comments
Closed

Prerender not finding window properties #1036

threeaccents opened this issue Aug 23, 2018 · 4 comments
Assignees
Projects

Comments

@threeaccents
Copy link

Stencil version:

@stencil/core@0.11.0

I'm submitting a:

[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:

When running npm run build I get lots of error's saying window properties couldn't be found. This only happens in the prerender step.

Expected behavior:

Window properties should be found and no compile error should be thrown.

Steps to reproduce:

Use window properties somewhere the code and try to compile the app with prerender.

Related code:

componentWillLoad() {
    const userId = localStorage.getItem('userId');
}

// adding the window object removes the error.
componentWillLoad() {
    const userId = window.localStorage.getItem('userId');
}

Other information:

Runtime error detected during componentWillLoad(): soli-app
           localStorage is not defined ReferenceError: localStorage is not defined at e.componentWillLoad
           (evalmachine.<anonymous>:2:18409) at update
           (/Users/digo/code/src/gitlab.com/threeaccents/soli/webapp/node_modules/@stencil/core/dist/compiler/index.js:10519:48)
           at plt.queue.tick
           (/Users/digo/code/src/gitlab.com/threeaccents/soli/webapp/node_modules/@stencil/core/dist/compiler/index.js:10477:34)
           at flush
           (/Users/digo/code/src/gitlab.com/threeaccents/soli/webapp/node_modules/@stencil/core/dist/compiler/index.js:11946:33)
           at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback
           (internal/process/next_tick.js:180:9)
@ionitron-bot ionitron-bot bot added the triage label Aug 23, 2018
@adamdbradley
Copy link
Contributor

Currently prerendering is getting refactored to use puppeteer, so this issue will be fixed in upcoming releases.

@adamdbradley adamdbradley added SSR and removed triage labels Aug 23, 2018
@adamdbradley adamdbradley self-assigned this Aug 23, 2018
@threeaccents
Copy link
Author

Cool I'm also getting some redux properties errors:

 Runtime error detected during componentWillLoad(): create-grow-view
           Cannot read property 'subscribe' of undefined TypeError: Cannot read property 'subscribe' of undefined at
           Object.mapStateToProps (evalmachine.<anonymous>:3:575) at t.initRedux (evalmachine.<anonymous>:2:17837) at
           t.componentWillLoad (evalmachine.<anonymous>:2:17688) at update
           (/Users/digo/code/src/gitlab.com/threeaccents/soli/webapp/node_modules/@stencil/core/dist/compiler/index.js:10519:48)
           at plt.queue.tick
           (/Users/digo/code/src/gitlab.com/threeaccents/soli/webapp/node_modules/@stencil/core/dist/compiler/index.js:10477:34)
           at flush
           (/Users/digo/code/src/gitlab.com/threeaccents/soli/webapp/node_modules/@stencil/core/dist/compiler/index.js:11946:33)
           at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback
           (internal/process/next_tick.js:180:9)

@jthoms1 jthoms1 added prerender and removed SSR labels Sep 10, 2018
@jthoms1 jthoms1 added this to Backlog 🤖 in Stencil via automation Sep 10, 2018
@balupton
Copy link

balupton commented Dec 28, 2018

just ran into this with https://github.com/balupton/stencil-ssr-on-zeit-now


didn't puppeteer get canned?

#442


How extensive is the puppeteer plan?

Adopting puppeteer could eliminate serverless (e.g. ziet now, cloudflare works) rendering of stencil components/pages/apps — which will be a growing environment for SSR, due to its cost, scaling, and speed benefits.

Unfortunately for me, I can't adopt stencil until it supports serverless rendering.


Considering SSR is completely broken right now, it would be nice if it this was reflected here:

https://stenciljs.com/docs/prerendering

@manucorporat
Copy link
Contributor

Stencil one will be able to support window/document usage thanks to V8's VM isolation! where we can execute your app under different context (globals).

Stencil automation moved this from Backlog 🤖 to Done 🎉 Apr 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Stencil
  
Done 🎉
Development

No branches or pull requests

5 participants