protonemedia/laravel-splade

Production build resulted with an empty page

Closed this issue · 2 comments

I was developing in local env with npm run dev

Then I deployed the app to the server and build frontend with npm run build
When I enter my app, the content showed up for a second, and in the next second it went to blank screen

Console log:

screen1

Any guess why?

It's hard to read anything from a file with over 100k cols. Anyway, this SyntaxError refers to my mistake in blade template file. I was merging two class attributes under one tag. Dev server didn't throw an error. Production one did. It blows though that it can't render an actual error, like for example Livewire do. But still, at this point great package.

For future readers:

In development, Vue lets you know in the console, but in production, it throws an error and stops rendering.

As of v1.4.13, I've added an option to suppress the error. In your main app.js file, you can use the suppress_compile_errors option:

createApp({
    render: renderSpladeApp({ el })
})
    .use(SpladePlugin, {
        "suppress_compile_errors": true
    })
    .mount(el);

Make sure to update both packages (JS + PHP).