diff --git a/package.json b/package.json index 8c42063..82f80b3 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "license": "BSD-3-Clause", "scripts": { "clean": "rimraf ./dist ./static/assets", - "start": "electron-webpack dev --bail --display-error-details --env.minify=false", - "compile": "electron-webpack --bail --display-error-details --env.minify=false", + "start": "mkdirp ./dist && electron-webpack dev --bail --display-error-details --env.minify=false", + "compile": "mkdirp ./dist && electron-webpack --bail --display-error-details --env.minify=false", "fetch": "rimraf ./static/assets/ && mkdirp ./static/assets/ && node ./scripts/fetchMediaLibraryAssets.js", "build": "npm run build:dev", "build:dev": "npm run compile && npm run doBuild -- --mode=dev", diff --git a/webpack.makeConfig.js b/webpack.makeConfig.js index 57b37e6..d3403b6 100644 --- a/webpack.makeConfig.js +++ b/webpack.makeConfig.js @@ -1,5 +1,7 @@ const childProcess = require('child_process'); +const fs = require('fs'); const path = require('path'); +const util = require('util'); const electronPath = require('electron'); const webpack = require('webpack'); @@ -56,7 +58,7 @@ const makeConfig = function (defaultConfig, options) { }); } - return merge.smart(defaultConfig, { + const config = merge.smart(defaultConfig, { devtool: 'cheap-module-eval-source-map', mode: isProduction ? 'production' : 'development', module: { @@ -117,6 +119,13 @@ const makeConfig = function (defaultConfig, options) { } } }); + + fs.writeFileSync( + `dist/webpack.${options.name}.js`, + `module.exports = ${util.inspect(config, {depth: null})};\n` + ); + + return config; }; module.exports = makeConfig;