@@ -40,11 +40,18 @@ module.exports = merge(baseConfig, {
40
40
whitelist: / \. css$ /
41
41
}),
42
42
43
- // This is the plugin that turns the entire output of the server build
44
- // into a single JSON file. The default file name will be
45
- // `vue-ssr-server-bundle.json`
43
+
46
44
plugins: [
47
- new VueSSRServerPlugin ()
45
+ // This is the plugin that turns the entire output of the server build
46
+ // into a single JSON file. The default file name will be
47
+ // `vue-ssr-server-bundle.json`
48
+ new VueSSRServerPlugin (),
49
+ // To make Vue.prototype.$isServer work, we have to make `VUE_ENV` available
50
+ // in the bundled application
51
+ new webpack.DefinePlugin ({
52
+ ' process.env.NODE_ENV' : JSON .stringify (process .env .NODE_ENV || ' development' ),
53
+ ' process.env.VUE_ENV' : ' "server"'
54
+ }),
48
55
]
49
56
})
50
57
```
@@ -102,7 +109,14 @@ module.exports = merge(baseConfig, {
102
109
}),
103
110
// This plugins generates `vue-ssr-client-manifest.json` in the
104
111
// output directory.
105
- new VueSSRClientPlugin ()
112
+ new VueSSRClientPlugin (),
113
+
114
+ // To make Vue.prototype.$isServer work, we have to make `VUE_ENV` available
115
+ // in the bundled application
116
+ new webpack.DefinePlugin ({
117
+ ' process.env.NODE_ENV' : JSON .stringify (process .env .NODE_ENV || ' development' ),
118
+ ' process.env.VUE_ENV' : ' "server"'
119
+ }),
106
120
]
107
121
})
108
122
```
0 commit comments