Unverified Commit 36164ead authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

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

parent 20fe65ce
let assetPrefix let assetPrefix = typeof window !== 'undefined' ? (window.__NEXT_DATA__.assetPrefix) : undefined
export default function asset (path) { export default function asset (path) {
// If the URL starts with http, we assume it's an // If the URL starts with http, we assume it's an
......
...@@ -5,7 +5,6 @@ import { createRouter } from 'next/router' ...@@ -5,7 +5,6 @@ import { createRouter } from 'next/router'
import EventEmitter from 'next-server/dist/lib/event-emitter' import EventEmitter from 'next-server/dist/lib/event-emitter'
import {loadGetInitialProps, getURL} from 'next-server/dist/lib/utils' import {loadGetInitialProps, getURL} from 'next-server/dist/lib/utils'
import PageLoader from './page-loader' import PageLoader from './page-loader'
import * as asset from 'next-server/asset'
import * as envConfig from 'next-server/config' import * as envConfig from 'next-server/config'
import ErrorBoundary from './error-boundary' import ErrorBoundary from './error-boundary'
import Loadable from 'next-server/dist/lib/loadable' import Loadable from 'next-server/dist/lib/loadable'
...@@ -38,8 +37,6 @@ const prefix = assetPrefix || '' ...@@ -38,8 +37,6 @@ const prefix = assetPrefix || ''
// With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time // 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 // So, this is how we do it in the client side at runtime
__webpack_public_path__ = `${prefix}/_next/` //eslint-disable-line __webpack_public_path__ = `${prefix}/_next/` //eslint-disable-line
// Initialize next/asset with the assetPrefix
asset.setAssetPrefix(prefix)
// Initialize next/config with the environment configuration // Initialize next/config with the environment configuration
envConfig.setConfig({ envConfig.setConfig({
serverRuntimeConfig: {}, serverRuntimeConfig: {},
......
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