Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 818a703

Browse files
committed
added guard against hmr #42
1 parent 53d92b5 commit 818a703

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/plugin.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Vue from 'vue'
33
const { join } = require('path')
44

55
const options = <%= JSON.stringify(options) %>
6-
76
const mdComps = {}
87

98
function importAllMdComps (r) {
@@ -30,9 +29,12 @@ Vue.component('nuxtent-body', {
3029
}
3130
})
3231

33-
export default ({ app, isClient, isServer }) => {
32+
export default ({ app, isServer, isClient, hotReload }) => {
33+
if (hotReload) return
34+
35+
const isAPI = isServer || !process.env.STATIC
3436
const cache = {}
35-
const isAPI = (options.isDev || isServer) && !process.env.STATIC
37+
3638
async function fetchContent (path, permalink, query = '') {
3739
if (isAPI) {
3840
const apiEndpoint = join(path, permalink + query)
@@ -45,7 +47,6 @@ export default ({ app, isClient, isServer }) => {
4547
const serializedPermalink = permalink.replace(allButFirstSlash, '.')
4648
const browserPath = join(path, serializedPermalink) + '.json'
4749
if (!cache[browserPath]) {
48-
// TODO catch errors
4950
cache[browserPath] = (await app.$axios.get(browserPath)).data
5051
}
5152
return cache[browserPath]

0 commit comments

Comments
 (0)