// resources/js/app.js
import Vue, {createApp} from 'vue';
import TemplateExport from "./components/TemplateExport";
const app = createApp({
template: {
TemplateExport,
}
})
// const app = new Vue({
// render: h => h(TemplateExport),
// });
export default app;
// resources/js/app-server.js
import app from "./app-client";
import renderVueComponentToString from "vue-server-renderer/basic";
renderVueComponentToString(app, (err, html) => {
if (err) {
throw new Error(err);
}
dispatch(html);
});
// resources/js/client-server.js
import app from './app';
app.mount('#app');
but this results in an error:
The command "/usr/bin/node /application/storage/app/ssr/c1d33d05b83783d3ec4888829f1e8e82.js" failed. Exit Code: 1(General error) Working directory: /application/public Output: ================ Error Output: ================ /application/storage/app/ssr/c1d33d05b83783d3ec4888829f1e8e82.js:43696 const res = document.querySelector(container); ^ ReferenceError: document is not defined at normalizeContainer (/application/storage/app/ssr/c1d33d05b83783d3ec4888829f1e8e82.js:43696:21) at Object.app.mount (/application/storage/app/ssr/c1d33d05b83783d3ec4888829f1e8e82.js:43654:27) at Module../resources/assets/js/app-client.js (/application/storage/app/ssr/c1d33d05b83783d3ec4888829f1e8e82.js:44409:43) at __webpack_require__ (/application/storage/app/ssr/c1d33d05b83783d3ec4888829f1e8e82.js:67965:42) at /application/storage/app/ssr/c1d33d05b83783d3ec4888829f1e8e82.js:68038:69 at /application/storage/app/ssr/c1d33d05b83783d3ec4888829f1e8e82.js:68051:3 at Object.<anonymous> (/application/storage/app/ssr/c1d33d05b83783d3ec4888829f1e8e82.js:68053:12) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) (View: /application/resources/views/test.blade.php)
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.
Could this package work for vue3? I tried:
but this results in an error: