Skip to content

Commit 7da0c6f

Browse files
committed
fix: add no-ssr for vue-live
1 parent a6dd4d7 commit 7da0c6f

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

enhanceAppFiles.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ module.exports = function enhanceAppFiles() {
1414
"}",
1515
// and in order for the loading to happen after we assign the variable,
1616
// we load vue-live as a require instead of an import
17-
`Vue.component("VueLive", () => import(${JSON.stringify(vueLivePath)}))`
17+
`Vue.component("VueLive", () => import(${JSON.stringify(
18+
vueLivePath
19+
)}));Vue.component("NoSsr", () => import('vue-no-ssr')) `
1820
].join("\n");
1921
return { name: "vue-live-enhancer", content };
2022
};

markDownPlugin.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ const addVueLive = md => {
4040
.replace(/\$/g, "\\$");
4141
const editorProps = langArray.find(l => /^\{.+\}$/.test(l));
4242
const jsx = langArray.length > 2 && langArray[1] === "jsx" ? "jsx " : ""; // to enable jsx, we want ```vue jsx live or ```jsx jsx live
43-
return `<vue-live ${jsx}:layoutProps="{lang:'${langClean}'}" :code="\`${codeClean}\`" :requires="{${requires.join(
43+
return `<no-ssr><vue-live ${jsx}:layoutProps="{lang:'${langClean}'}" :code="\`${codeClean}\`" :requires="{${requires.join(
4444
","
45-
)}}"${editorProps ? ` :editorProps="${editorProps}"` : ""} />`;
45+
)}}"${editorProps ? ` :editorProps="${editorProps}"` : ""} /></no-ssr>`;
4646
};
4747
};
4848

package-lock.json

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"dependencies": {
3838
"acorn": "^6.1.1",
3939
"vue-live": "^1.6.0",
40+
"vue-no-ssr": "^1.1.1",
4041
"walkes": "^0.2.1"
4142
}
4243
}

0 commit comments

Comments
 (0)