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

Move dev error view import to dev entry point (#3093)

This drops a few kb off of the production min+gz build due to the remove of the component and a ew dependencies that it references, ansi-html being the biggest.
This commit is contained in:
Kevin Decker 2017-10-15 16:19:01 -05:00 committed by Tim Neutkens
parent 7271970629
commit fa18e13bf6
2 changed files with 5 additions and 3 deletions

View file

@ -5,7 +5,6 @@ import { createRouter } from '../lib/router'
import EventEmitter from '../lib/EventEmitter'
import App from '../lib/app'
import { loadGetInitialProps, getURL } from '../lib/utils'
import ErrorDebugComponent from '../lib/error-debug'
import PageLoader from '../lib/page-loader'
// Polyfill Promise globally
@ -53,14 +52,16 @@ const errorContainer = document.getElementById('__next-error')
let lastAppProps
export let router
export let ErrorComponent
let ErrorDebugComponent
let Component
export default async () => {
export default async ({ ErrorDebugComponent: passedDebugComponent } = {}) => {
// Wait for all the dynamic chunks to get loaded
for (const chunkName of chunks) {
await pageLoader.waitForChunk(chunkName)
}
ErrorDebugComponent = passedDebugComponent
ErrorComponent = await pageLoader.loadPage('/_error')
try {

View file

@ -1,11 +1,12 @@
import 'react-hot-loader/patch'
import initNext, * as next from './'
import ErrorDebugComponent from '../lib/error-debug'
import initOnDemandEntries from './on-demand-entries-client'
import initWebpackHMR from './webpack-hot-middleware-client'
window.next = next
initNext()
initNext({ ErrorDebugComponent })
.then((emitter) => {
initOnDemandEntries()
initWebpackHMR()