Commit 77c10b24 authored by Arunoda Susiripala's avatar Arunoda Susiripala

Removes the unused renderScript function

parent 33f8f282
...@@ -7,7 +7,6 @@ import generateETag from 'etag' ...@@ -7,7 +7,6 @@ import generateETag from 'etag'
import fresh from 'fresh' import fresh from 'fresh'
import requireModule from './require' import requireModule from './require'
import getConfig from './config' import getConfig from './config'
import resolvePath from './resolve'
import { Router } from '../lib/router' import { Router } from '../lib/router'
import { loadGetInitialProps } from '../lib/utils' import { loadGetInitialProps } from '../lib/utils'
import Head, { defaultHead } from '../lib/head' import Head, { defaultHead } from '../lib/head'
...@@ -125,22 +124,6 @@ async function doRender (req, res, pathname, query, { ...@@ -125,22 +124,6 @@ async function doRender (req, res, pathname, query, {
return '<!DOCTYPE html>' + renderToStaticMarkup(doc) return '<!DOCTYPE html>' + renderToStaticMarkup(doc)
} }
export async function renderScript (req, res, page, opts) {
try {
const dist = getConfig(opts.dir).distDir
const path = join(opts.dir, dist, 'bundles', 'pages', page)
const realPath = await resolvePath(path)
await serveStatic(req, res, realPath)
} catch (err) {
if (err.code === 'ENOENT') {
renderScriptError(req, res, page, err, {}, opts)
return
}
throw err
}
}
export async function renderScriptError (req, res, page, error, customFields, { dev }) { export async function renderScriptError (req, res, page, error, customFields, { dev }) {
// Asks CDNs and others to not to cache the errored page // Asks CDNs and others to not to cache the errored page
res.setHeader('Cache-Control', 'no-store, must-revalidate') res.setHeader('Cache-Control', 'no-store, must-revalidate')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment