Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Commit

Permalink
fix: windows path contains \u symbols (#152) (#154)
Browse files Browse the repository at this point in the history
Co-authored-by: Vasily Mikhaylovsky <github-public@3apaxi.com>
  • Loading branch information
Vasily Mikhaylovsky and Vasily Mikhaylovsky authored Nov 28, 2021
1 parent bdfabc9 commit cddd1e9
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ async function genTemplateRequest(
const query = `?vue${from}&type=template${srcQuery}${attrsQuery}`
const templateRequest = src + query
return {
code: `import { render as __vue2_render, staticRenderFns as __vue2_staticRenderFns } from '${templateRequest}'`,
code: `import { render as __vue2_render, staticRenderFns as __vue2_staticRenderFns } from ${JSON.stringify(
templateRequest
)}`,
templateRequest,
}
}
Expand Down Expand Up @@ -229,26 +231,26 @@ function genHmrCode(
functional: boolean,
templateRequest?: string
) {
const idJSON = JSON.stringify(id)
return `\n/* hot reload */
import __VUE_HMR_RUNTIME__ from "${vueHotReload}"
import __VUE_HMR_RUNTIME__ from ${JSON.stringify(vueHotReload)}
import vue from "vue"
__VUE_HMR_RUNTIME__.install(vue)
if(__VUE_HMR_RUNTIME__.compatible){
if (!__VUE_HMR_RUNTIME__.isRecorded('${id}')) {
__VUE_HMR_RUNTIME__.createRecord('${id}', __component__.options)
if (!__VUE_HMR_RUNTIME__.isRecorded(${idJSON})) {
__VUE_HMR_RUNTIME__.createRecord(${idJSON}, __component__.options)
}
import.meta.hot.accept((update) => {
__VUE_HMR_RUNTIME__.${
functional ? 'rerender' : 'reload'
}('${id}', update.default)
}(${idJSON}, update.default)
})
${
templateRequest
? `import.meta.hot.accept('${normalizeDevPath(
root,
templateRequest
)}', (update) => {
__VUE_HMR_RUNTIME__.rerender('${id}', update)
? `import.meta.hot.accept(${JSON.stringify(
normalizeDevPath(root, templateRequest)
)}, (update) => {
__VUE_HMR_RUNTIME__.rerender(${idJSON}, update)
})`
: ''
}
Expand Down

0 comments on commit cddd1e9

Please sign in to comment.