view client/vue.config.js @ 1947:4235fa8f59d7

clien: pdf-gen: load logo externally; add prepare step * Change the way how the logo to be placed in the pdf is loaded: It can be configured in the `.env.localĀ“ file, otherwise a placeholder will be loaded from the static assets. The placeholder has not been placed in `assets` because it won't be needed if a real logo has been specified and thus should not compiled in by default. * Add a mechanism to do asynchronous preparations before rendering. This is needed for the completeion of the Image() loading, but it also shows how asynchronous preparational step can be added in principle. * Disable the start button when the current rendering is in progress.
author Bernhard Reiter <bernhard@intevation.de>
date Tue, 22 Jan 2019 10:01:08 +0100
parents 89b38d7e7b6a
children 84d01a536bec
line wrap: on
line source

const CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = {
  outputDir: "../web",
  configureWebpack: {
    devtool: "source-map"
  },
  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
      });
    if (process.env.ANALYZE) {
      var BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
        .BundleAnalyzerPlugin;
      config.plugin("BundleAnalyzerPlugin").use(BundleAnalyzerPlugin, []);
    }
  },
  css: {
    loaderOptions: {
      // pass options to sass-loader
      sass: {
        // @/ is an alias to src/
        data: `@import "@/assets/application.scss";`
      }
    }
  },
  devServer: {
    proxy: {
      "/api": {
        target: process.env.VUE_BACKEND_API_URL,
        secure: false
      },
      "/img/*": {
        target: "http://localhost:5000",
        secure: false
      }
    },
    disableHostCheck: true
  }
};