Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Include svg and js.map in the extension list determining SSR (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
ganemone authored Mar 20, 2019
1 parent 5572da5 commit 5755a73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/__tests__/index.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ test('disable SSR by composing SSRDecider with a function', async t => {

test('SSR extension handling', async t => {
const extensionToSSRSupported = {
'js.map': false,
svg: false,
js: false,
gif: false,
jpg: false,
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const SSRDecider = createPlugin<{}, SSRDeciderService>({
return ctx => {
// If the request has one of these extensions, we assume it's not something that requires server-side rendering of virtual dom
// TODO(#46): this check should probably look at the asset manifest to ensure asset 404s are handled correctly
if (ctx.path.match(/\.(js|gif|jpg|png|pdf|json)$/)) return false;
if (ctx.path.match(/\.(js|js\.map|gif|jpg|png|pdf|json|svg)$/))
return false;

// Bots don't always include the accept header.
if (ctx.headers['user-agent']) {
Expand Down

0 comments on commit 5755a73

Please sign in to comment.