반응형
"V8Js::compileString():1812:ReferenceError:document is not defined" Larabel VueJS & V8Js TypeScript
VueJs를 사용하여 SSR를 구현하고 V8Js를 사용하여 Larabel에 VueRouter를 구현하려고 하면 다음 오류가 계속 발생합니다.
V8JsScriptException
V8Js::compileString():1812: ReferenceError: document is not defined
import App from './app'
import Vue from "vue";
import router from "./router";
let app = new Vue(App);
Vue.config.productionTip = false;
// @ts-ignore
export default new Promise((resolve, reject) => {
// @ts-ignore
router.push(url);
router.onReady(() => {
const matchedComponents = router.getMatchedComponents();
if (!matchedComponents.length) {
return reject({
code: 404
});
}
resolve(app);
}, reject);
}).then(app => {
// @ts-ignore
renderVueComponentToString(app, (err, res) => {
// @ts-ignore
print(res);
});
}).catch((err) => {
// @ts-ignore
print(err);
});
...
$js =
<<<EOT
var process = { env: { VUE_ENV: "server", NODE_ENV: "production" } };
this.global = { process: process };
var url = "$path";
EOT;
$v8 = new \V8Js();
$v8->executeString($js);
$v8->executeString($renderer_source);
$v8->executeString($app_source);
$markup = ob_get_clean();
return $markup;
...
SSR에는 창도 문서도 없지만 어디에 오류가 있는지 알 수 없습니다.제가 더 자세한 정보를 드릴 수 있다면 감사합니다.
언급URL : https://stackoverflow.com/questions/52241150/v8jscompilestring1812-referenceerror-document-is-not-defined-laravel-vu
반응형
'programing' 카테고리의 다른 글
char* 변수가 빈 문자열을 가리키는지 확인하려면 어떻게 해야 합니까? (0) | 2022.07.21 |
---|---|
Vue.js, 컴포넌트에서 SweetAlert2 html 폼 데이터를 입력하는 방법 (0) | 2022.07.14 |
Java: 쉼표로 구분된 문자열을 분할하지만 따옴표로 둘러싸인 쉼표는 무시합니다. (0) | 2022.07.14 |
Java 8 스트림 역순서 (0) | 2022.07.14 |
VueJs Propos에 여러 데이터 유형을 추가하는 방법 (0) | 2022.07.14 |