From eff91fc9913705e83162304e297c2dddaf0b318c Mon Sep 17 00:00:00 2001 From: Adolfo Panizo Date: Tue, 6 Mar 2018 12:03:03 +0100 Subject: [PATCH] WIP Making prod script to work --- config/webpack.config.prod.js | 193 ++++++++++++++++++++++++++++++++++ package-lock.json | 64 +++++++++++ package.json | 6 +- 3 files changed, 262 insertions(+), 1 deletion(-) create mode 100644 config/webpack.config.prod.js diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js new file mode 100644 index 00000000..3cfe0470 --- /dev/null +++ b/config/webpack.config.prod.js @@ -0,0 +1,193 @@ +const autoprefixer = require('autoprefixer'); +const cssvars = require('postcss-simple-vars'); +const webpack = require('webpack'); + +const HtmlWebpackPlugin = require('html-webpack-plugin'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const ManifestPlugin = require('webpack-manifest-plugin'); +const url = require('url'); + +var paths = require('./paths'); +var getClientEnvironment = require('./env'); + +var 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: function () { + return Object.assign({}, cssvariables); + }, + silent: true + }), +]; + +function ensureSlash(path, needsSlash) { + var hasSlash = path.endsWith('/'); + if (hasSlash && !needsSlash) { + return path.substr(path, path.length - 1); + } else if (!hasSlash && needsSlash) { + return path + '/'; + } else { + 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