mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
Fix __route error when importing a page inside a page (#3644)
* Check if Component is defined * Add comment * Fix linting
This commit is contained in:
parent
7b2cd84fee
commit
4db7e8fe9e
|
@ -5,8 +5,11 @@ module.exports = function (content, sourceMap) {
|
|||
|
||||
const route = getRoute(this)
|
||||
|
||||
// Webpack has a built in system to prevent default from colliding, giving it a random letter per export.
|
||||
// We can safely check if Component is undefined since all other pages imported into the entrypoint don't have __webpack_exports__.default
|
||||
this.callback(null, `${content}
|
||||
(function (Component, route) {
|
||||
if(!Component) return
|
||||
if (!module.hot) return
|
||||
module.hot.accept()
|
||||
Component.__route = route
|
||||
|
|
Loading…
Reference in a new issue