Skip to content

Commit

Permalink
feat: explicitly define content type (#235)
Browse files Browse the repository at this point in the history
* feat: explicitly define content type

Signed-off-by: Pianist038801 <[email protected]>

* Fixed port issue - OSX Big Sur now uses 5555 by default

Signed-off-by: Jason Porter <[email protected]>

Co-authored-by: Pianist038801 <[email protected]>
Co-authored-by: Jason Porter <[email protected]>
  • Loading branch information
3 people authored Nov 16, 2021
1 parent a64e138 commit 0cbcd13
Show file tree
Hide file tree
Showing 3 changed files with 375 additions and 23 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
"webpack-hot-middleware": "^2.24.3",
"webpack-hot-server-middleware": "^0.5.0",
"webpack-node-externals": "^1.7.2",
"webpack-plugin-serve": "^1.5.0",
"webpack-stats-plugin": "^0.2.1",
"xstate": "^4.11.0"
},
Expand Down
14 changes: 13 additions & 1 deletion webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as CompressionWebpackPlugin from 'compression-webpack-plugin';
import * as HTMLWebpackPlugin from 'html-webpack-plugin';
import * as path from 'path';
import * as webpack from 'webpack';
const { WebpackPluginServe: ServePlugin } = require('webpack-plugin-serve');
const { StatsWriterPlugin } = require('webpack-stats-plugin');
const FavIconWebpackPlugin = require('favicons-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
Expand Down Expand Up @@ -291,10 +292,21 @@ export const clientConfig: webpack.Configuration = {
if (isDev) {
return [
...plugins,
hmrPlugin
// namedModulesPlugin,
new ServePlugin({
middleware: (app, builtins) =>
app.use(async (ctx, next) => {
await next();
ctx.setHeader(
'Content-Type',
'application/javascript; charset=UTF-8'
);
}),
port: 7777
})
];
}

return plugins;
}
};
Expand Down
Loading

0 comments on commit 0cbcd13

Please sign in to comment.