Giter Site home page Giter Site logo

Comments (9)

chrisvfritz avatar chrisvfritz commented on August 19, 2024

If everything else is working though, it sounds like it has to either be phantomjs or vue-apollo. It's possible that vue-apollo is using a browser feature that isn't yet supported in phantomjs.

from prerender-spa-plugin.

xpepermint avatar xpepermint commented on August 19, 2024

I think it could be related to this issue.

The example below works:

var page = require('webpage').create();

page.settings.loadImages = false
page.settings.localToRemoteUrlAccessEnabled = true
page.settings.resourceTimeout = 15000

page.onInitialized = function() {
  if(page.injectJs('core.js')) { // FIX PROBLEMS
    console.log("Polyfills loaded");
  }
};

page.open('http://localhost:8080');

setTimeout(function () {
  var html = page.evaluate(function () {
    return document.documentElement.outerHTML
  });

  console.log(html.trim())
  phantom.exit()
}, 3000)

from prerender-spa-plugin.

xpepermint avatar xpepermint commented on August 19, 2024

The problem definitely represents the Phantom.js. I would propose the http://www.nightmarejs.org/ package instead (it uses a modern browser through electron).

from prerender-spa-plugin.

chrisvfritz avatar chrisvfritz commented on August 19, 2024

I remember researching nightmare previously and having to rule it out for this kind of work, but that was possibly ~6 months ago, so it's possible whatever the problem was, it's fixed now.

I might not have time to explore that in the very near future, but if you wanted to fork this project and try to port it to nightmare, I'd be very curious. I'm definitely not opposed to adding nightmare as an alternative rendering option.

from prerender-spa-plugin.

chrisvfritz avatar chrisvfritz commented on August 19, 2024

I'm also open to a PR that injects core.js.

from prerender-spa-plugin.

xpepermint avatar xpepermint commented on August 19, 2024

I'm glad to hear that. I think that Nightmere is a good replacement and it works (tested). Let's leave this issue opened and I'll try to jump in, but I'm not sure when.

from prerender-spa-plugin.

satyadeeproat avatar satyadeeproat commented on August 19, 2024

@xpepermint I tried working on the same code you have written. But the console is not displaying the polyfills loaded. Maybe there is an error in this part
page.onInitialized = function() {
if(page.injectJs('core.js')) { // FIX PROBLEMS
console.log("Polyfills loaded");
}
};

Do we need to install babel-polyfill or core.js before that?

from prerender-spa-plugin.

xpepermint avatar xpepermint commented on August 19, 2024

@satyadeeproat at the end I decided to write a simple SSR package vue-builder.

from prerender-spa-plugin.

chrisvfritz avatar chrisvfritz commented on August 19, 2024

Fixed in the 2.0 release, as we now inject core.js into phantom before prerendering. 🎉

from prerender-spa-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.