Comments (9)
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.
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.
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.
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.
I'm also open to a PR that injects core.js.
from prerender-spa-plugin.
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.
@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.
@satyadeeproat at the end I decided to write a simple SSR package vue-builder.
from prerender-spa-plugin.
Fixed in the 2.0 release, as we now inject core.js into phantom before prerendering. 🎉
from prerender-spa-plugin.
Related Issues (20)
- Plugin creates broken HTML HOT 1
- Puppeteer Issues on Oracle Linux 8 HOT 2
- Optimization of Puppeteer
- I have a Vue multi-page app, after prerender, all html files look the same. HOT 1
- render each route to an html file
- Only two pages are getting pre-rendered properly
- How to cache the result.
- docker
- on Safari and ios it doesn't always work
- [prerender-spa-plugin] Unable to prerender all routes! HOT 4
- How to configure puppeteer inside prerender-spa for Heroku
- How to launch puppeteer with { args: ['--no-sandbox'] }?
- "/" page flashing before routes load
- Unexpected token '?' with plugin only HOT 2
- Looking for maintainers! HOT 15
- Error during building example app: probably smth with websocket errno: -4039, code: 'ETIMEDOUT'
- Vue Prerender-SPA / Webpack - Application won't initialise with named cacheGroups unless explicitly listed in pages config chunks section?
- why no such file or directory
- Unable to prerender all routes! HOT 2
- Page refresh twice
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prerender-spa-plugin.