未验证 提交 36164ead 编写于 作者: T Tim Neutkens 提交者: GitHub

Don’t bundle next/asset if it’s not used (#5971)

上级 20fe65ce
let assetPrefix
let assetPrefix = typeof window !== 'undefined' ? (window.__NEXT_DATA__.assetPrefix) : undefined
export default function asset (path) {
// If the URL starts with http, we assume it's an
......
......@@ -5,7 +5,6 @@ import { createRouter } from 'next/router'
import EventEmitter from 'next-server/dist/lib/event-emitter'
import {loadGetInitialProps, getURL} from 'next-server/dist/lib/utils'
import PageLoader from './page-loader'
import * as asset from 'next-server/asset'
import * as envConfig from 'next-server/config'
import ErrorBoundary from './error-boundary'
import Loadable from 'next-server/dist/lib/loadable'
......@@ -38,8 +37,6 @@ const prefix = assetPrefix || ''
// With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
// So, this is how we do it in the client side at runtime
__webpack_public_path__ = `${prefix}/_next/` //eslint-disable-line
// Initialize next/asset with the assetPrefix
asset.setAssetPrefix(prefix)
// Initialize next/config with the environment configuration
envConfig.setConfig({
serverRuntimeConfig: {},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册