Code Monkey home page Code Monkey logo

Comments (6)

lichnow avatar lichnow commented on June 13, 2024

i found the problem ,that is () => import('xxx.vue'),but how to support it?

from laravel-server-side-rendering.

josteph avatar josteph commented on June 13, 2024

Got the same issue with () => import('xxx.vue'). How do I solve this?

EDIT:
Nevermind, the issue is not here. I was able to get past the issue above but there are more things to solve:

app-server.js

import app from './app'
import renderer from 'vue-server-renderer/basic'

renderer(app, (err, html) => {
	console.log(html)
    if (err) {
        throw new Error(err);
    }

    dispatch(html);
})

The console.log returns the actual string of Vue HTML. But the problem is, doing {!! ssr('js/app-server.js')->render() !!} in the Blade file doesn't show anything (just empty string, and console.log is not even called!).

from laravel-server-side-rendering.

vaggelis2018 avatar vaggelis2018 commented on June 13, 2024

even with babel dynamic imports it does not work. Maybe it uses window to add the chunks which are going to be called on page load. I think it has to do more with the lazy loading.

from laravel-server-side-rendering.

spatie-bot avatar spatie-bot commented on June 13, 2024

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

from laravel-server-side-rendering.

fannyfan414 avatar fannyfan414 commented on June 13, 2024

Got the same issue with () => import('xxx.vue'). How do I solve this?

EDIT:
Nevermind, the issue is not here. I was able to get past the issue above but there are more things to solve:

app-server.js

import app from './app'
import renderer from 'vue-server-renderer/basic'

renderer(app, (err, html) => {
	console.log(html)
    if (err) {
        throw new Error(err);
    }

    dispatch(html);
})

The console.log returns the actual string of Vue HTML. But the problem is, doing {!! ssr('js/app-server.js')->render() !!} in the Blade file doesn't show anything (just empty string, and console.log is not even called!).

how did you solve problem with chunks?

from laravel-server-side-rendering.

sentiasa avatar sentiasa commented on June 13, 2024

I'm having the same issue, with lazy-loading it doesn't work.

Did any of you guys figure out a solution?

I also asked on SO - https://stackoverflow.com/questions/58216963/lazy-loaded-vue-router-components-dont-work-with-ssr

TLDR;
This works:

import Home from '../view/Home';
export const routes = [{ path: '/', name: "Home", component: Home }]

These don't
1: This compiles but when I visit the page it says "Cannot find module './js/chunks/server/0.js"

const Home = import('../views/Home');
export const routes = [{ path: '/', name: "Home", component: Home }]

2: Compiles but - Error: render function or template not defined in component: anonymous

const Home = require('../views/Home');
export const routes = [{ path: '/', name: "Home", component: Home }]

from laravel-server-side-rendering.

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.