3
的HMR API中的WebPack文檔中提到了以下方法:HMR - 接受多個依賴
accept(dependencies: string[], callback: (updatedDependencies) => void) => void
我明白,我怎麼能接受一個單一的依賴,但我不能確定多依賴回調應該怎麼樣子。
這裏是我的代碼:
var $ = require('jquery')
var page = require('page')
var index = require('./index')
var home = require('./home')
$(function() {
page('/', index)
page('/home', home)
page()
if (module.hot) {
module.hot.accept(['./index', './home'], function(updatedDependencies) {
// what should I put in here?
})
}
})