Style tweak

This commit is contained in:
Michael Jackson 2018-05-15 18:21:46 -07:00
parent 9a3aabda9f
commit 8c6912e1a1
1 changed files with 3 additions and 1 deletions

View File

@ -79,6 +79,8 @@ function serveFile(req, res) {
let contentType = getFileContentType(file); let contentType = getFileContentType(file);
if (contentType === "application/javascript" && req.query.module != null) { if (contentType === "application/javascript" && req.query.module != null) {
contentType += "; charset=utf-8";
// Serve a JavaScript module. // Serve a JavaScript module.
rewriteBareModuleIdentifiers(file, req.packageConfig, (error, code) => { rewriteBareModuleIdentifiers(file, req.packageConfig, (error, code) => {
if (error) { if (error) {
@ -103,7 +105,7 @@ function serveFile(req, res) {
// Cache modules for 1 year. // Cache modules for 1 year.
res res
.set({ .set({
"Content-Type": `${contentType}; charset=utf-8`, "Content-Type": contentType,
"Content-Length": Buffer.byteLength(code), "Content-Length": Buffer.byteLength(code),
"Cache-Control": "public, max-age=31536000", "Cache-Control": "public, max-age=31536000",
"Cache-Tag": "file,js-file,js-module" "Cache-Tag": "file,js-file,js-module"