Commit 4db7e8fe authored by Tim Neutkens's avatar Tim Neutkens Committed by Arunoda Susiripala

Fix __route error when importing a page inside a page (#3644)

* Check if Component is defined

* Add comment

* Fix linting
parent 7b2cd84f
...@@ -5,8 +5,11 @@ module.exports = function (content, sourceMap) { ...@@ -5,8 +5,11 @@ module.exports = function (content, sourceMap) {
const route = getRoute(this) 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} this.callback(null, `${content}
(function (Component, route) { (function (Component, route) {
if(!Component) return
if (!module.hot) return if (!module.hot) return
module.hot.accept() module.hot.accept()
Component.__route = route Component.__route = route
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment