/*eslint-disable*/ const BundleAnalyzerPlugin = require("webpack-bundle-analyzer") .BundleAnalyzerPlugin const autoprefixer = require("autoprefixer") const cssmixins = require("postcss-mixins") const cssvars = require("postcss-simple-vars") const webpack = require("webpack") const TerserPlugin = require("terser-webpack-plugin") const HtmlWebpackPlugin = require("html-webpack-plugin") const ExtractTextPlugin = require("extract-text-webpack-plugin") const ManifestPlugin = require("webpack-manifest-plugin") const MiniCssExtractPlugin = require("mini-css-extract-plugin") const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin") const url = require("url") const paths = require("./paths") const getClientEnvironment = require("./env") const cssvariables = require(`${paths.appSrc}/theme/variables`) const postcssPlugins = [ autoprefixer({ overrideBrowserslist: [ ">1%", "last 4 versions", "Firefox ESR", "not ie < 9" // React doesn't support IE8 anyway ] }), cssmixins, cssvars({ variables() { return Object.assign({}, cssvariables) }, silent: true }) ] function ensureSlash(path, needsSlash) { const hasSlash = path.endsWith("/") if (hasSlash && !needsSlash) { return path.substr(path, path.length - 1) } else if (!hasSlash && needsSlash) { return `${path}/` } return path } // We use "homepage" field to infer "public path" at which the app is served. // Webpack needs to know it to put the right