Skip to content

Commit

Permalink
feat(app-webpack): tweak ssr - server entry on importing and dealing …
Browse files Browse the repository at this point in the history
…with boot files #17658
  • Loading branch information
rstoenescu committed Nov 23, 2024
1 parent bd318c6 commit c5efe9e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions app-webpack/templates/entry/server-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,20 @@ const { components, directives, ...qUserOptions } = quasarUserOptions
<%
const bootEntries = boot.filter(asset => asset.server !== false)
if (bootEntries.length !== 0) { %>
const bootFiles = Promise.all([
let bootFunctions = null
let bootFiles = Promise.allSettled([
<% bootEntries.forEach((asset, index) => { %>
import(/* webpackMode: "eager" */ '<%= asset.path %>')<%= index < bootEntries.length - 1 ? ',' : '' %>
<% }) %>
]).then(bootFiles => bootFiles.map(entry => entry.default).filter(entry => typeof entry === 'function'))
])
.then(bootFiles => bootFiles.map(result => {
if (result.status === 'rejected') {
console.error('[Quasar] boot error:', result.reason)
return
}
return result.value.default
}))
.then(bootFiles => bootFiles.filter(entry => typeof entry === 'function'))
<% } %>

// This is where we perform data-prefetching to determine the
Expand All @@ -85,7 +94,10 @@ const bootFiles = Promise.all([
export default ssrContext => {
return new Promise(async (resolve, reject) => {
<% if (bootEntries.length !== 0) { %>
const bootFunctions = await bootFiles
if (bootFunctions === null) {
bootFunctions = await bootFiles
bootFiles = null
}
<% } %>

const {
Expand Down

0 comments on commit c5efe9e

Please sign in to comment.