Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: explicitly define content type #235

Merged
merged 2 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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