From 33395ccb331f8dd04933559cc68458c63dd264ed Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Thu, 12 Jan 2017 12:26:36 -0600 Subject: [PATCH] Add a dev build configuration Add caching and a faster source map for the dev builds. This brings the rebuild time down to about 500ms for me. dev build now puts the bundle in the electron app/js directory so that the app can be automatically reloaded --- webpack.config.js | 4 ++-- webpack.dev.config.js | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 webpack.dev.config.js diff --git a/webpack.config.js b/webpack.config.js index bdfd83191..fdafd70b2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -25,8 +25,8 @@ module.exports = { loaders: [ { test: /\.css$/, loader: "style!css" }, { - test: /\.jsx?$/, - loader: 'babel', + test: /\.jsx?$/, + loader: 'babel', query: { cacheDirectory: true, presets:[ 'es2015', 'react', 'stage-2' ] diff --git a/webpack.dev.config.js b/webpack.dev.config.js new file mode 100644 index 000000000..b84f2f94a --- /dev/null +++ b/webpack.dev.config.js @@ -0,0 +1,41 @@ +const path = require('path'); + +const PATHS = { + app: path.join(__dirname, 'app'), + dist: path.join(__dirname, '..', 'app', 'dist') +}; + +module.exports = { + entry: ['babel-polyfill', './js/main.js'], + output: { + path: path.join(PATHS.dist, 'js'), + publicPath: '/js/', + filename: "bundle.js", + pathinfo: true + }, + debug: true, + cache: true, + devtool: 'eval', + module: { + preLoaders: [ + { + test: /\.jsx?$/, + loaders: ['eslint'], + // define an include so we check just the files we need + include: PATHS.app + } + ], + loaders: [ + { test: /\.css$/, loader: "style!css" }, + { + test: /\.jsx?$/, + loader: 'babel', + query: { + cacheDirectory: true, + presets:[ 'es2015', 'react', 'stage-2' ] + } + } + ] + }, + target: 'electron-main', +};