Skip to content

Commit bf275ec

Browse files
author
Guillaume Chau
committed
feat: NO_HMR env var
1 parent cb2f0f2 commit bf275ec

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

packages/vue-component-dev-client/client/dev-client.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { Meteor } from 'meteor/meteor'
55
import { Autoupdate } from 'meteor/autoupdate'
66
import VueHot1 from './vue-hot'
77
import VueHot2 from './vue2-hot'
8-
// Hack https://github.com/socketio/socket.io-client/issues/961
9-
import Response from 'meteor-node-stubs/node_modules/http-browserify/lib/response'
8+
9+
if (__meteor_runtime_config__.VUE_NO_HMR) return
1010

1111
const tagStyle = 'padding: 2px 4px 1px; background: #326ABC; color: white; border-radius: 3px; font-weight: bold;'
1212
const infoStyle = 'font-style: italic; color: #326ABC;'
@@ -85,13 +85,6 @@ if (ClientVersions) {
8585
console.warn('%cHRM', tagStyle, 'ClientVersions collection is not available, the app may full reload.')
8686
}
8787

88-
// Hack https://github.com/socketio/socket.io-client/issues/961
89-
if (!Response.prototype.setEncoding) {
90-
Response.prototype.setEncoding = function (encoding) {
91-
// do nothing
92-
}
93-
}
94-
9588
Meteor.startup(function () {
9689
// Dev client
9790
let devUrl = __meteor_runtime_config__.VUE_DEV_SERVER_URL

packages/vue-component-dev-server/server/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ const DEVURL = process.env.HMR_URL || process.env.VUE_DEV_SERVER_URL || getLocal
4545

4646
// Client-side config
4747
__meteor_runtime_config__.VUE_DEV_SERVER_URL = DEVURL.indexOf(':') === -1 ? `${DEVURL}:${PORT}` : DEVURL
48+
__meteor_runtime_config__.VUE_NO_HMR = !!process.env.NO_HMR

packages/vue-component/plugin/dev-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if (global._dev_server_http) {
5353
delete global._dev_server_http
5454
}
5555

56-
if (Meteor.isDevelopment) {
56+
if (isDevelopment()) {
5757
var server = http.createServer()
5858
var io = SocketIo(server, {
5959
serveClient: false,

packages/vue-component/plugin/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ getFilePath = function (inputFile) {
6767
}
6868

6969
isDevelopment = function () {
70-
return Meteor.isDevelopment
70+
return Meteor.isDevelopment && !process.env.NO_HMR
7171
}
7272

7373
getLineNumber = function (contents, charIndex) {

0 commit comments

Comments
 (0)