webpack: Use assets object immutably.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-09-25 19:44:32 -07:00 committed by Tim Abbott
parent fa3ea59833
commit 5006255069
1 changed files with 8 additions and 5 deletions

View File

@ -26,7 +26,14 @@ export default (env?: string): webpack.Configuration[] => {
name: "frontend",
mode: production ? "production" : "development",
context: __dirname,
entry: assets,
entry: production
? assets
: Object.fromEntries(
Object.entries(assets).map(([name, paths]) => [
name,
[...paths, "./static/js/debug"],
]),
),
module: {
rules: [
{
@ -256,10 +263,6 @@ export default (env?: string): webpack.Configuration[] => {
};
if (!production) {
// Out JS debugging tools
for (const paths of Object.values(assets)) {
paths.push("./static/js/debug");
}
config.devServer = {
clientLogLevel: "error",
headers: {