1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

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

This commit is contained in:
Tim Neutkens 2018-12-31 19:05:34 +01:00 committed by GitHub
parent 20fe65ce41
commit 36164ead80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 4 deletions

View file

@ -1,4 +1,4 @@
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

View file

@ -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 || ''
// 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: {},