Skip to content

Commit

Permalink
bg(Fix Heroku)Fix Heroku Configurations
Browse files Browse the repository at this point in the history
- configures app to read heroku environment variables

[#162693956]
  • Loading branch information
dnuwa committed Dec 19, 2018
1 parent e5af190 commit 848e4dc
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 29 deletions.
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"main": "index.js",
"scripts": {
"start:dev": "webpack-dev-server --open --config webpack.dev.js ",
"start:prod": "npm run build && serve -s dist",
"start": "serve -s dist",
"start:prod": "npm run build && serve dist",
"build": "webpack --config webpack.prod.js",
"lint": "eslint src",
"heroku-postbuild": "npm run build",
"postinstall": "npm run build",
"test": "jest",
"test:cov": "jest --coverage --env='jsdom'",
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls"
Expand Down Expand Up @@ -37,6 +37,7 @@
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.4",
"coveralls": "^3.0.2",
"env-cmd": "^8.0.2",
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.7.0",
"enzyme-to-json": "^3.3.4",
Expand All @@ -48,7 +49,7 @@
"eslint-plugin-react": "^7.11.1"
},
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-class-properties": "^7.2.1",
"@fortawesome/fontawesome-svg-core": "^1.2.8",
"@fortawesome/free-brands-svg-icons": "^5.5.0",
"@fortawesome/free-solid-svg-icons": "^5.5.0",
Expand Down Expand Up @@ -90,13 +91,11 @@
"redux-mock-store": "^1.5.3",
"redux-thunk": "^2.3.0",
"sass-loader": "^7.1.0",
"serve": "^10.1.1",
"sweetalert2": "^7.29.2",
"webpack": "^4.26.1",
"webpack": "^4.27.1",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10",
"webpack-merge": "^4.1.4",
"@babel/plugin-proposal-class-properties": "^7.2.1"
"webpack-merge": "^4.1.4"
},
"jest": {
"snapshotSerializers": [
Expand Down
9 changes: 9 additions & 0 deletions static.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"root": "dist/",
"routes": {
"/": "index.html"
},
"proxies": {
"/api/": "https://ah-backend-thanos-staging.herokuapp.com/"
}
}
26 changes: 12 additions & 14 deletions webpack.common.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const Dotenv = require('dotenv-webpack');

module.exports = {
entry: {
app: './src/index.js'
app: './src/index.js',
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
path: path.resolve(__dirname, 'dist'),
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
loader: 'babel-loader',
},
},
{
test: /\.html$/,
use: [
{
loader: 'html-loader',
options: { minimize: true }
}
]
options: { minimize: true },
},
],
},
{
test: /\.(css|scss)$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
},
{
test: /\.(png|jpg)$/,
include: path.join(__dirname, 'static/images'),
loader: 'file-loader'
loader: 'file-loader',
},
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
Expand All @@ -45,9 +44,9 @@ module.exports = {
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
}
outputPath: 'fonts/',
},
},
],
},
],
Expand All @@ -64,6 +63,5 @@ module.exports = {
filename: '[name].css',
chunkFilename: '[id].css',
}),
new Dotenv(),
],
};
15 changes: 9 additions & 6 deletions webpack.dev.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const merge = require('webpack-merge');
const Dotenv = require('dotenv-webpack');
const common = require('./webpack.common.js');


module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: './dist'
}
});
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: './dist',
},
plugins: [new Dotenv()],
});
4 changes: 2 additions & 2 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ const merge = require('webpack-merge');
const common = require('./webpack.common.js');

module.exports = merge(common, {
mode: 'production',
});
mode: 'production',
});

0 comments on commit 848e4dc

Please sign in to comment.