write configs to files in dist/ for debugging purposes

This commit is contained in:
Christopher Willis-Ford 2020-08-11 19:14:39 -07:00
parent f6a336af20
commit 0e1c90afeb
2 changed files with 12 additions and 3 deletions

View file

@ -7,8 +7,8 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"scripts": { "scripts": {
"clean": "rimraf ./dist ./static/assets", "clean": "rimraf ./dist ./static/assets",
"start": "electron-webpack dev --bail --display-error-details --env.minify=false", "start": "mkdirp ./dist && electron-webpack dev --bail --display-error-details --env.minify=false",
"compile": "electron-webpack --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", "fetch": "rimraf ./static/assets/ && mkdirp ./static/assets/ && node ./scripts/fetchMediaLibraryAssets.js",
"build": "npm run build:dev", "build": "npm run build:dev",
"build:dev": "npm run compile && npm run doBuild -- --mode=dev", "build:dev": "npm run compile && npm run doBuild -- --mode=dev",

View file

@ -1,5 +1,7 @@
const childProcess = require('child_process'); const childProcess = require('child_process');
const fs = require('fs');
const path = require('path'); const path = require('path');
const util = require('util');
const electronPath = require('electron'); const electronPath = require('electron');
const webpack = require('webpack'); 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', devtool: 'cheap-module-eval-source-map',
mode: isProduction ? 'production' : 'development', mode: isProduction ? 'production' : 'development',
module: { 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; module.exports = makeConfig;