Skip to content

Commit

Permalink
Add redux-devtools-extension
Browse files Browse the repository at this point in the history
also move installation of all extensions to main process
  • Loading branch information
jhen0409 committed Jun 23, 2016
1 parent a322be3 commit 5338f9d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
5 changes: 0 additions & 5 deletions app/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
<div id="root"></div>
<script>
(function() {
if (process.env.NODE_ENV === 'development') {
const devtoolsInstaller = require('electron-devtools-installer');
devtoolsInstaller.default(devtoolsInstaller.REACT_DEVELOPER_TOOLS).catch(() => {});
}

const script = document.createElement('script');
script.src = (process.env.HOT) ? 'http://localhost:3000/dist/bundle.js' : '../dist/bundle.js';
document.write(script.outerHTML);
Expand Down
19 changes: 18 additions & 1 deletion main.development.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,24 @@ app.on('window-all-closed', () => {
});


app.on('ready', () => {
const installExtensions = async () => {
if (process.env.NODE_ENV === 'development') {
const installer = require('electron-devtools-installer'); // eslint-disable-line global-require
const extensions = [
'REACT_DEVELOPER_TOOLS',
'REDUX_DEVTOOLS'
];
for (const name of extensions) {
try {
await installer.default(installer[name]);
} catch (e) {} // eslint-disable-line
}
}
};

app.on('ready', async () => {
await installExtensions();

mainWindow = new BrowserWindow({
show: false,
width: 1024,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build-renderer": "cross-env NODE_ENV=production node -r babel-register ./node_modules/webpack/bin/webpack --config webpack.config.production.js --progress --profile --colors",
"build": "npm run build-main && npm run build-renderer",
"start": "cross-env NODE_ENV=production electron ./",
"start-hot": "cross-env HOT=1 NODE_ENV=development electron -r babel-register ./main.development",
"start-hot": "cross-env HOT=1 NODE_ENV=development electron -r babel-register -r babel-polyfill ./main.development",
"package": "cross-env NODE_ENV=production node -r babel-register package.js",
"package-all": "npm run package -- --all",
"postinstall": "node node_modules/fbjs-scripts/node/check-dev-engines.js package.json",
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
libraryTarget: 'commonjs2'
},
resolve: {
extensions: ['', '.js', '.jsx'],
extensions: ['', '.js', '.jsx', '.json'],
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main']
},
plugins: [
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {

devtool: 'source-map',

entry: './main.development',
entry: ['babel-polyfill', './main.development'],

output: {
...baseConfig.output,
Expand Down

0 comments on commit 5338f9d

Please sign in to comment.