Skip to content

Commit

Permalink
Merge pull request #36 from AndrewGable/andrew-fix
Browse files Browse the repository at this point in the history
Fix dev/prod issues by splitting up webpack configs
  • Loading branch information
tgolen authored Aug 10, 2020
2 parents 8a4998d + b655e4a commit fb44706
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ local.properties
node_modules/
npm-debug.log
yarn-error.log
dist/

# BUCK
buck-out/
Expand Down
68 changes: 63 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"web": "webpack-dev-server --open --config webpack.config.js",
"build": "webpack --config webpack.config.js",
"web": "webpack-dev-server --open --config webpack.dev.js",
"build": "webpack --config webpack.prod.js",
"test": "jest",
"lint": "eslint ."
},
Expand Down Expand Up @@ -54,7 +54,8 @@
"react-test-renderer": "16.13.1",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^5.1.1"
},
"jest": {
"preset": "react-native"
Expand Down
1 change: 1 addition & 0 deletions src/lib/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function request(command, data, type = 'post') {
if (responseData.jsonCode === 200) {
return responseData;
}
// eslint-disable-next-line no-console
console.info('[API] Error', responseData);
})
// eslint-disable-next-line no-unused-vars
Expand Down
1 change: 1 addition & 0 deletions src/lib/Pusher/pusher.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ function unsubscribe(channelName, eventName = '') {
channel.unbind(eventName);
} else {
if (!channel.subscribed) {
// eslint-disable-next-line no-console
console.warn('[Pusher] Attempted to unsubscribe from channel, but we are not subscribed to begin with', 0, {channelName});
return;
}
Expand Down
1 change: 1 addition & 0 deletions src/store/actions/PersonalDetailsActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ function fetch() {
})
.catch((error) => {
if (error.message === 'No login') {
// eslint-disable-next-line no-console
console.info('No email in store, not fetching personal details.');
return;
}
Expand Down
2 changes: 2 additions & 0 deletions src/store/actions/ReportActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ function fetchAll() {
return data;
})
.then(data => Store.set(STOREKEYS.REPORTS, _.values(data.reports)))
// eslint-disable-next-line no-console
.catch((error) => { console.log('Error fetching report actions', error); });
}

Expand All @@ -146,6 +147,7 @@ function fetchAll() {
return data;
})
.then(data => Store.set(STOREKEYS.REPORTS, _.values(data.reportListBeta)))
// eslint-disable-next-line no-console
.catch((error) => { console.log('Error fetching report actions', error); });
}

Expand Down
6 changes: 0 additions & 6 deletions webpack.config.js → webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@ const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
mode: 'development',
entry: {
app: './web/index.js',
},
output: {
filename: '[name]-[hash].bundle.js',
path: path.resolve(__dirname, 'dist'),
},
devtool: 'inline-source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
hot: true,
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
Expand Down
12 changes: 12 additions & 0 deletions webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path');
const {merge} = require('webpack-merge');
const common = require('./webpack.common.js');

module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: path.join(__dirname, 'dist'),
hot: true,
},
});
7 changes: 7 additions & 0 deletions webpack.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const {merge} = require('webpack-merge');
const common = require('./webpack.common.js');

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

0 comments on commit fb44706

Please sign in to comment.