From 01b093056c44ec13bae30cd3e0e836031229e51a Mon Sep 17 00:00:00 2001 From: Jason Porter <84735036+jsonporter@users.noreply.github.com> Date: Thu, 18 Nov 2021 08:46:24 -0800 Subject: [PATCH] Add correct mime type to headers (#240) * Moved serve middleware to apply to both prod and dev builds * Refactored next funciton Signed-off-by: Jason Porter --- webpack.config.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/webpack.config.ts b/webpack.config.ts index d7e30be80d..8b15cb2cdf 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -279,7 +279,18 @@ export const clientConfig: webpack.Configuration = { new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true }), favIconPlugin, statsWriterPlugin, - getDefinePlugin(false) + getDefinePlugin(false), + new ServePlugin({ + middleware: (app, builtins) => + app.use(async (ctx, next) => { + ctx.setHeader( + 'Content-Type', + 'application/javascript; charset=UTF-8' + ); + await next(); + }), + port: 7777 + }) ]; // Apply production specific configs @@ -291,19 +302,8 @@ export const clientConfig: webpack.Configuration = { if (isDev) { return [ - ...plugins, + ...plugins // namedModulesPlugin, - new ServePlugin({ - middleware: (app, builtins) => - app.use(async (ctx, next) => { - await next(); - ctx.setHeader( - 'Content-Type', - 'application/javascript; charset=UTF-8' - ); - }), - port: 7777 - }) ]; }