Commit fb1306e6 authored by Evan You's avatar Evan You

fix: properly stringify hot-reload-api path for Windows

parent c6727838
const hotReloadAPIPath = require.resolve('vue-hot-reload-api')
const hotReloadAPIPath = JSON.stringify(require.resolve('vue-hot-reload-api'))
exports.genHotReloadCode = (id, functional) => {
return wrap(`
......@@ -13,7 +13,7 @@ exports.genHotReloadCode = (id, functional) => {
exports.genTemplateHotReloadCode = id => {
return wrap(`
if (module.hot.data) {
require('${hotReloadAPIPath}').rerender('${id}', {
require(${hotReloadAPIPath}).rerender('${id}', {
render: render,
staticRenderFns: staticRenderFns
})
......@@ -25,7 +25,7 @@ function wrap (inner) {
return `
/* hot reload */
if (module.hot) {
var api = require('${hotReloadAPIPath}')
var api = require(${hotReloadAPIPath})
api.install(require('vue'))
if (api.compatible) {
module.hot.accept()
......
const { attrsToQuery } = require('./utils')
const hotReloadAPIPath = require.resolve('vue-hot-reload-api')
const hotReloadAPIPath = JSON.stringify(require.resolve('vue-hot-reload-api'))
module.exports = function genStyleInjectionCode (
loaderContext,
......@@ -59,7 +59,7 @@ module.exports = function genStyleInjectionCode (
var newLocals = require(${request})
if (JSON.stringify(newLocals) !== JSON.stringify(oldLocals)) {
cssModules[${name}] = newLocals
require("${hotReloadAPIPath}").rerender("${id}")
require(${hotReloadAPIPath}).rerender("${id}")
}
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment