提交 fa18e13b 编写于 作者: K Kevin Decker 提交者: Tim Neutkens

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.
上级 72719706
...@@ -5,7 +5,6 @@ import { createRouter } from '../lib/router' ...@@ -5,7 +5,6 @@ import { createRouter } from '../lib/router'
import EventEmitter from '../lib/EventEmitter' import EventEmitter from '../lib/EventEmitter'
import App from '../lib/app' import App from '../lib/app'
import { loadGetInitialProps, getURL } from '../lib/utils' import { loadGetInitialProps, getURL } from '../lib/utils'
import ErrorDebugComponent from '../lib/error-debug'
import PageLoader from '../lib/page-loader' import PageLoader from '../lib/page-loader'
// Polyfill Promise globally // Polyfill Promise globally
...@@ -53,14 +52,16 @@ const errorContainer = document.getElementById('__next-error') ...@@ -53,14 +52,16 @@ const errorContainer = document.getElementById('__next-error')
let lastAppProps let lastAppProps
export let router export let router
export let ErrorComponent export let ErrorComponent
let ErrorDebugComponent
let Component let Component
export default async () => { export default async ({ ErrorDebugComponent: passedDebugComponent } = {}) => {
// Wait for all the dynamic chunks to get loaded // Wait for all the dynamic chunks to get loaded
for (const chunkName of chunks) { for (const chunkName of chunks) {
await pageLoader.waitForChunk(chunkName) await pageLoader.waitForChunk(chunkName)
} }
ErrorDebugComponent = passedDebugComponent
ErrorComponent = await pageLoader.loadPage('/_error') ErrorComponent = await pageLoader.loadPage('/_error')
try { try {
......
import 'react-hot-loader/patch' import 'react-hot-loader/patch'
import initNext, * as next from './' import initNext, * as next from './'
import ErrorDebugComponent from '../lib/error-debug'
import initOnDemandEntries from './on-demand-entries-client' import initOnDemandEntries from './on-demand-entries-client'
import initWebpackHMR from './webpack-hot-middleware-client' import initWebpackHMR from './webpack-hot-middleware-client'
window.next = next window.next = next
initNext() initNext({ ErrorDebugComponent })
.then((emitter) => { .then((emitter) => {
initOnDemandEntries() initOnDemandEntries()
initWebpackHMR() initWebpackHMR()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册