const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const autoprefixer = require('autoprefixer') const cssvars = require('postcss-simple-vars') const webpack = require('webpack') const UglifyJSPlugin = require('uglifyjs-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') const ExtractTextPlugin = require('extract-text-webpack-plugin') const ManifestPlugin = require('webpack-manifest-plugin') const url = require('url') const paths = require('./paths') const getClientEnvironment = require('./env') const cssvariables = require(`${paths.appSrc}/theme/variables`) const postcssPlugins = [ autoprefixer({ browsers: [ '>1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9', // React doesn't support IE8 anyway ], }), 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