From 9cad6991dbd9d25b37062eda50361e0c3a0983a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20L=C3=BCnborg?= Date: Sat, 22 Dec 2018 09:44:25 +0100 Subject: [PATCH 1/2] add DefinePlugin to webpack example config We need to demonstrate how to pass VUE_ENV to the app --- docs/guide/build-config.md | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/docs/guide/build-config.md b/docs/guide/build-config.md index d027d82e..f7095437 100644 --- a/docs/guide/build-config.md +++ b/docs/guide/build-config.md @@ -40,11 +40,18 @@ module.exports = merge(baseConfig, { whitelist: /\.css$/ }), - // This is the plugin that turns the entire output of the server build - // into a single JSON file. The default file name will be - // `vue-ssr-server-bundle.json` + plugins: [ - new VueSSRServerPlugin() + // This is the plugin that turns the entire output of the server build + // into a single JSON file. The default file name will be + // `vue-ssr-server-bundle.json` + new VueSSRServerPlugin(), + // To make Vue.prototype.$isServer work, we have to make `VUE_ENV` available + // in the bundled application + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), + 'process.env.VUE_ENV': '"server"' + }), ] }) ``` @@ -102,7 +109,14 @@ module.exports = merge(baseConfig, { }), // This plugins generates `vue-ssr-client-manifest.json` in the // output directory. - new VueSSRClientPlugin() + new VueSSRClientPlugin(), + + // To make Vue.prototype.$isServer work, we have to make `VUE_ENV` available + // in the bundled application + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), + 'process.env.VUE_ENV': '"server"' + }), ] }) ``` From 6883af463ef5da1556acaae2753efae85aac1a13 Mon Sep 17 00:00:00 2001 From: Damian Stasik Date: Mon, 29 Apr 2019 10:33:46 +0200 Subject: [PATCH 2/2] Update docs/guide/build-config.md fix typo Co-Authored-By: LinusBorg --- docs/guide/build-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/build-config.md b/docs/guide/build-config.md index f7095437..f5e6ba05 100644 --- a/docs/guide/build-config.md +++ b/docs/guide/build-config.md @@ -115,7 +115,7 @@ module.exports = merge(baseConfig, { // in the bundled application new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), - 'process.env.VUE_ENV': '"server"' + 'process.env.VUE_ENV': '"client"' }), ] })