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

Init next.js even after dom is loaded. (#326)

Earlier we add a event to init next.js when dom has loaded.
But if at that time dom is already loaded, next.js won't get init ever.
Now we are using domready NPM module which handle these for us.
This commit is contained in:
Arunoda Susiripala 2016-12-02 19:29:10 +05:30 committed by Naoyuki Kanezawa
parent ea5ec12c2d
commit 65c4e1e5bd
3 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import { createElement } from 'react'
import { render } from 'react-dom'
import HeadManager from './head-manager'
import domready from 'domready'
import { rehydrate } from '../lib/css'
import Router from '../lib/router'
import App from '../lib/app'
@ -10,7 +11,7 @@ const {
__NEXT_DATA__: { component, errorComponent, props, ids, err }
} = window
document.addEventListener('DOMContentLoaded', () => {
domready(() => {
const Component = evalScript(component).default
const ErrorComponent = evalScript(errorComponent).default

View file

@ -14,6 +14,6 @@
"author": "",
"license": "ISC",
"next": {
"cdn": false
"cdn": true
}
}

View file

@ -66,6 +66,7 @@
"babel-runtime": "6.18.0",
"cross-spawn": "5.0.1",
"del": "2.2.2",
"domready": "1.0.8",
"friendly-errors-webpack-plugin": "1.1.1",
"glamor": "2.20.8",
"glob-promise": "2.0.0",