Skip to content

Commit fb1306e

Browse files
committed
fix: properly stringify hot-reload-api path for Windows
1 parent c672783 commit fb1306e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: lib/codegen/hotReload.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const hotReloadAPIPath = require.resolve('vue-hot-reload-api')
1+
const hotReloadAPIPath = JSON.stringify(require.resolve('vue-hot-reload-api'))
22

33
exports.genHotReloadCode = (id, functional) => {
44
return wrap(`
@@ -13,7 +13,7 @@ exports.genHotReloadCode = (id, functional) => {
1313
exports.genTemplateHotReloadCode = id => {
1414
return wrap(`
1515
if (module.hot.data) {
16-
require('${hotReloadAPIPath}').rerender('${id}', {
16+
require(${hotReloadAPIPath}).rerender('${id}', {
1717
render: render,
1818
staticRenderFns: staticRenderFns
1919
})
@@ -25,7 +25,7 @@ function wrap (inner) {
2525
return `
2626
/* hot reload */
2727
if (module.hot) {
28-
var api = require('${hotReloadAPIPath}')
28+
var api = require(${hotReloadAPIPath})
2929
api.install(require('vue'))
3030
if (api.compatible) {
3131
module.hot.accept()

Diff for: lib/codegen/styleInjection.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { attrsToQuery } = require('./utils')
2-
const hotReloadAPIPath = require.resolve('vue-hot-reload-api')
2+
const hotReloadAPIPath = JSON.stringify(require.resolve('vue-hot-reload-api'))
33

44
module.exports = function genStyleInjectionCode (
55
loaderContext,
@@ -59,7 +59,7 @@ module.exports = function genStyleInjectionCode (
5959
var newLocals = require(${request})
6060
if (JSON.stringify(newLocals) !== JSON.stringify(oldLocals)) {
6161
cssModules[${name}] = newLocals
62-
require("${hotReloadAPIPath}").rerender("${id}")
62+
require(${hotReloadAPIPath}).rerender("${id}")
6363
}
6464
}
6565
})

0 commit comments

Comments
 (0)