From a8e991237e2567f827f3ede67ddef0d50efd2f75 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 22 Mar 2019 11:42:56 +0100 Subject: geocode thing prod react build --- package.json | 3 ++- webpack.geocode.prod.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ webpack.splash.prod.js | 1 - 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 webpack.geocode.prod.js diff --git a/package.json b/package.json index 3dbb8353..4cd2f10d 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "deploy": "NODE_ENV=production webpack --config ./webpack.config.prod.js && git commit -am 'deploy' && git push origin master && ssh vframe@vframe ./restart.sh", "watchSplash": "NODE_ENV=development webpack --config ./webpack.splash.dev.js --colors --watch", "buildSplash": "NODE_ENV=production webpack --config ./webpack.splash.prod.js", - "watchGeocode": "NODE_ENV=development webpack --config ./webpack.geocode.dev.js --colors --watch" + "watchGeocode": "NODE_ENV=development webpack --config ./webpack.geocode.dev.js --colors --watch", + "buildGeocode": "NODE_ENV=production webpack --config ./webpack.geocode.prod.js" }, "repository": { "type": "git", diff --git a/webpack.geocode.prod.js b/webpack.geocode.prod.js new file mode 100644 index 00000000..0c3b3bcb --- /dev/null +++ b/webpack.geocode.prod.js @@ -0,0 +1,49 @@ +require('dotenv').config() + +const webpack = require('webpack') +const path = require('path') +const UglifyJsPlugin = require('uglifyjs-webpack-plugin') + +module.exports = { + entry: { + main: './scraper/client/index.js' + }, + output: { + path: path.resolve(__dirname, 'scraper/reports'), + filename: 'geocode-app.js' + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': '"production"', + 'process.env.S3_HOST': '"' + process.env.S3_HOST + '"', + 'process.env.API_HOST': '""', + }), + new UglifyJsPlugin(), + new webpack.optimize.AggressiveMergingPlugin() + ], + devtool: 'inline-source-map', + module: { + rules: [ + { + test: /\.css$/, + use: ['style-loader', 'css-loader'] + }, + { + test: /\.js$/, + // include: path.resolve(__dirname, 'client'), + exclude: /(node_modules|bower_components|build)/, + loader: 'babel-loader', + options: { + presets: ['env'], + plugins: [ + require('babel-plugin-transform-runtime'), + require('babel-plugin-transform-es2015-arrow-functions'), + require('babel-plugin-transform-object-rest-spread'), + require('babel-plugin-transform-class-properties'), + require('babel-plugin-transform-react-jsx'), + ] + } + } + ] + } +}; diff --git a/webpack.splash.prod.js b/webpack.splash.prod.js index 78359a8c..e0689424 100644 --- a/webpack.splash.prod.js +++ b/webpack.splash.prod.js @@ -3,7 +3,6 @@ require('dotenv').config() const webpack = require('webpack') const path = require('path') const UglifyJsPlugin = require('uglifyjs-webpack-plugin') -// const CleanWebpackPlugin = require('clean-webpack-plugin') module.exports = { entry: { -- cgit v1.2.3-70-g09d2