Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit 033c427

Browse files
committed
fix hot-reload-api path (fix #93)
1 parent b26c438 commit 033c427

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/compiler.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ var assign = require('object-assign')
1313
var deindent = require('de-indent')
1414
var Emitter = require('events').EventEmitter
1515

16+
// determine hot-reload-api location
17+
var hotReloadAPIPath = 'vue-hot-reload-api'
18+
try {
19+
require(hotReloadAPIPath)
20+
} catch (e) {
21+
// likely Npm 2.x
22+
hotReloadAPIPath = 'vueify/node_modules/vue-hot-reload-api'
23+
}
24+
1625
var htmlMinifyOptions = {
1726
collapseWhitespace: true,
1827
removeComments: true,
@@ -136,7 +145,7 @@ compiler.compile = function (content, filePath, cb) {
136145
output +=
137146
'if (module.hot) {(function () {' +
138147
' module.hot.accept()\n' +
139-
' var hotAPI = require("vueify/node_modules/vue-hot-reload-api")\n' +
148+
' var hotAPI = require("' + hotReloadAPIPath + '")\n' +
140149
' hotAPI.install(require("vue"), true)\n' +
141150
' if (!hotAPI.compatible) return\n' +
142151
// remove style tag on dispose

0 commit comments

Comments
 (0)