Skip to content

Commit

Permalink
add octet-stream handling
Browse files Browse the repository at this point in the history
  • Loading branch information
FredKSchott committed Jan 18, 2021
1 parent 10f3461 commit 76dca31
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions snowpack/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,12 +474,18 @@ export async function startServer(commandOptions: CommandOptions): Promise<Snowp
if (isProxyModule) {
code = await wrapImportProxy({url: reqPath, code: code.toString(), hmr: isHMR, config});
}
let contentType = path.extname(originalReqPath)
? mime.lookup(path.extname(originalReqPath))
: 'application/javascript';
// We almost never want an 'application/octet-stream' response, so just
// convert to JS until we have proper "raw" handling in the URL for non-JS responses.
if (contentType === 'application/octet-stream') {
contentType = 'application/javascript';
}
return {
contents: encodeResponse(code, encoding),
originalFileLoc: null,
contentType: path.extname(originalReqPath)
? mime.lookup(path.extname(originalReqPath))
: 'application/javascript',
contentType,
};
} catch (err) {
const errorTitle = `Dependency Load Error`;
Expand Down

1 comment on commit 76dca31

@vercel
Copy link

@vercel vercel bot commented on 76dca31 Jan 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.