diff client/vue.config.js @ 23:c1ef0be0ae3d

Improve build chain In order to improve the build, there is the need to include external asset during build time. The variable `VUE_APP_VENDOR_IMG_PATH` defines the source folder of the vendor images. The destination folder is /web/img/. To improve readability comments to .env.sample variables were added.
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 21 Jun 2018 13:39:01 +0200
parents d16f799e0469
children 71970f03c9e8
line wrap: on
line diff
--- a/client/vue.config.js	Thu Jun 21 12:53:16 2018 +0200
+++ b/client/vue.config.js	Thu Jun 21 13:39:01 2018 +0200
@@ -1,12 +1,23 @@
+var CopyWebpackPlugin = require("copy-webpack-plugin");
+
 module.exports = {
   outputDir: "../web",
+  chainWebpack: config => {
+    let vendorImgPath = process.env.VUE_APP_VENDOR_IMG_PATH;
+    if (!vendorImgPath) return;
+    config
+      .plugin("CopyWebpackPlugin")
+      .use(CopyWebpackPlugin, [[{ from: vendorImgPath, to: "img" }]], {
+        copyUnmodified: true
+      });
+  },
   devServer: {
     proxy: {
       "/api/*": {
         target: "http://localhost:8000",
         secure: false
       },
-      "/assets/*": {
+      "/img/*": {
         target: "http://localhost:5000",
         secure: false
       }