mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Removes the unused renderScript function
This commit is contained in:
parent
33f8f28209
commit
77c10b24c5
|
@ -7,7 +7,6 @@ import generateETag from 'etag'
|
|||
import fresh from 'fresh'
|
||||
import requireModule from './require'
|
||||
import getConfig from './config'
|
||||
import resolvePath from './resolve'
|
||||
import { Router } from '../lib/router'
|
||||
import { loadGetInitialProps } from '../lib/utils'
|
||||
import Head, { defaultHead } from '../lib/head'
|
||||
|
@ -125,22 +124,6 @@ async function doRender (req, res, pathname, query, {
|
|||
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 }) {
|
||||
// Asks CDNs and others to not to cache the errored page
|
||||
res.setHeader('Cache-Control', 'no-store, must-revalidate')
|
||||
|
|
Loading…
Reference in a new issue