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

Commit 8550260

Browse files
committed
skip css and hot-reload in server mode
1 parent 68694e9 commit 8550260

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/compiler.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ compiler.applyConfig = function (config) {
6060
}
6161

6262
compiler.compile = function (content, filePath, cb) {
63+
var isProduction = process.env.NODE_ENV === 'production'
64+
var isServer = process.env.VUE_ENV === 'server'
65+
var isTest = !!process.env.VUEIFY_TEST
66+
6367
// generate css scope id
6468
var id = 'data-v-' + genId(filePath)
6569
// parse the component into parts
@@ -96,7 +100,7 @@ compiler.compile = function (content, filePath, cb) {
96100
var map = null
97101
// styles
98102
var style = resolvedParts.styles.join('\n')
99-
if (style) {
103+
if (style && !isServer) {
100104
// emit style
101105
compiler.emit('style', {
102106
file: filePath,
@@ -126,7 +130,7 @@ compiler.compile = function (content, filePath, cb) {
126130
// template
127131
var template = resolvedParts.template
128132
if (template) {
129-
if (process.env.NODE_ENV !== 'production') {
133+
if (!isProduction && !isServer) {
130134
output +=
131135
'if (__vue__options__.functional) {console.error("' +
132136
'[vueify] functional components are not supported and ' +
@@ -142,7 +146,7 @@ compiler.compile = function (content, filePath, cb) {
142146
output += '__vue__options__._scopeId = "' + id + '"\n'
143147
}
144148
// hot reload
145-
if (process.env.NODE_ENV !== 'production' && !process.env.VUEIFY_TEST) {
149+
if (!isProduction && !isTest && !isServer) {
146150
output +=
147151
'if (module.hot) {(function () {' +
148152
' var hotAPI = require("' + hotReloadAPIPath + '")\n' +

0 commit comments

Comments
 (0)