-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for __dirname #8334
Fix for __dirname #8334
Conversation
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
buildDuration | 25.7s | 24.8s | -903ms |
nodeModulesSize | 41.3 MB | 42.6 MB |
Client Bundles (main, webpack, commons)
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.js | 17.9 kB | 17.9 kB | ✓ |
main-HASH.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-HASH.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
commons.HASH.js | 190 kB | 190 kB | ✓ |
commons.HASH.js gzip | 61.6 kB | 61.6 kB | ✓ |
Overall change | ✓ |
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.module.js | 16.2 kB | 16.2 kB | ✓ |
main-HASH.module.js gzip | 6.28 kB | 6.27 kB | -1 B |
webpack-HASH.module.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.module.js gzip | 746 B | 746 B | ✓ |
commons.HASH.module.js | 171 kB | 171 kB | ✓ |
commons.HASH.module.js gzip | 55.4 kB | 55.4 kB | ✓ |
Overall change | ✓ |
Client Pages
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.js | 1.9 kB | 1.9 kB | ✓ |
_app.js gzip | 905 B | 905 B | ✓ |
_error.js | 12.1 kB | 12.1 kB | ✓ |
_error.js gzip | 4.76 kB | 4.76 kB | ✓ |
hooks.js | 1.06 kB | 1.06 kB | ✓ |
hooks.js gzip | 600 B | 601 B | |
index.js | 343 B | 343 B | ✓ |
index.js gzip | 237 B | 237 B | ✓ |
link.js | 8.13 kB | 8.13 kB | ✓ |
link.js gzip | 3.49 kB | 3.49 kB | -1 B |
routerDirect.js | 429 B | 429 B | ✓ |
routerDirect.js gzip | 292 B | 292 B | ✓ |
withRouter.js | 439 B | 439 B | ✓ |
withRouter.js gzip | 290 B | 289 B | -1 B |
Overall change | ✓ |
Client Pages Modern
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.module.js | 1.79 kB | 1.79 kB | ✓ |
_app.module.js gzip | 865 B | 865 B | ✓ |
_error.module.js | 10.6 kB | 10.6 kB | ✓ |
_error.module.js gzip | 4.31 kB | 4.31 kB | ✓ |
hooks.module.js | 596 B | 596 B | ✓ |
hooks.module.js gzip | 354 B | 354 B | ✓ |
index.module.js | 319 B | 319 B | ✓ |
index.module.js gzip | 238 B | 238 B | ✓ |
link.module.js | 8.52 kB | 8.52 kB | ✓ |
link.module.js gzip | 3.67 kB | 3.67 kB | ✓ |
routerDirect.module.js | 417 B | 417 B | ✓ |
routerDirect.module.js gzip | 292 B | 292 B | ✓ |
withRouter.module.js | 427 B | 427 B | ✓ |
withRouter.module.js gzip | 291 B | 291 B | ✓ |
Overall change | ✓ |
Fetched pages
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
link | 2.8 kB | 2.8 kB | ✓ |
link gzip | 850 B | 847 B | -3 B |
index | 2.75 kB | 2.75 kB | ✓ |
index gzip | 840 B | 838 B | -2 B |
withRouter | 2.81 kB | 2.81 kB | ✓ |
withRouter gzip | 837 B | 834 B | -3 B |
Overall change | ✓ |
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
buildDuration | 26.5s | 28.5s | |
nodeModulesSize | 41.3 MB | 42.6 MB |
Client Bundles (main, webpack, commons)
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.js | 17.9 kB | 17.9 kB | ✓ |
main-HASH.js gzip | 6.56 kB | 6.56 kB | ✓ |
webpack-HASH.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
commons.HASH.js | 190 kB | 190 kB | ✓ |
commons.HASH.js gzip | 61.6 kB | 61.6 kB | ✓ |
Overall change | ✓ |
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.module.js | 16.2 kB | 16.2 kB | ✓ |
main-HASH.module.js gzip | 6.28 kB | 6.28 kB | ✓ |
webpack-HASH.module.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.module.js gzip | 746 B | 746 B | ✓ |
commons.HASH.module.js | 171 kB | 171 kB | ✓ |
commons.HASH.module.js gzip | 55.4 kB | 55.4 kB | ✓ |
Overall change | ✓ |
Client Pages
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.js | 1.9 kB | 1.9 kB | ✓ |
_app.js gzip | 905 B | 905 B | ✓ |
_error.js | 12.1 kB | 12.1 kB | ✓ |
_error.js gzip | 4.76 kB | 4.76 kB | ✓ |
hooks.js | 1.06 kB | 1.06 kB | ✓ |
hooks.js gzip | 600 B | 600 B | ✓ |
index.js | 343 B | 343 B | ✓ |
index.js gzip | 237 B | 237 B | ✓ |
link.js | 8.13 kB | 8.13 kB | ✓ |
link.js gzip | 3.49 kB | 3.49 kB | ✓ |
routerDirect.js | 429 B | 429 B | ✓ |
routerDirect.js gzip | 292 B | 292 B | ✓ |
withRouter.js | 439 B | 439 B | ✓ |
withRouter.js gzip | 290 B | 290 B | ✓ |
Overall change | ✓ |
Client Pages Modern
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.module.js | 1.79 kB | 1.79 kB | ✓ |
_app.module.js gzip | 865 B | 865 B | ✓ |
_error.module.js | 10.6 kB | 10.6 kB | ✓ |
_error.module.js gzip | 4.31 kB | 4.31 kB | ✓ |
hooks.module.js | 596 B | 596 B | ✓ |
hooks.module.js gzip | 354 B | 354 B | ✓ |
index.module.js | 319 B | 319 B | ✓ |
index.module.js gzip | 238 B | 238 B | ✓ |
link.module.js | 8.52 kB | 8.52 kB | ✓ |
link.module.js gzip | 3.67 kB | 3.67 kB | ✓ |
routerDirect.module.js | 417 B | 417 B | ✓ |
routerDirect.module.js gzip | 292 B | 292 B | ✓ |
withRouter.module.js | 427 B | 427 B | ✓ |
withRouter.module.js gzip | 291 B | 291 B | ✓ |
Overall change | ✓ |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_error.js | 247 kB | 247 kB | |
_error.js gzip | 66.3 kB | 66.3 kB | |
hooks.html | 2.87 kB | 2.87 kB | ✓ |
hooks.html gzip | 864 B | 867 B | |
index.js | 248 kB | 248 kB | |
index.js gzip | 66.6 kB | 66.6 kB | |
link.js | 255 kB | 255 kB | |
link.js gzip | 68.8 kB | 68.8 kB | |
routerDirect.js | 248 kB | 248 kB | |
routerDirect.js gzip | 66.5 kB | 66.5 kB | |
withRouter.js | 248 kB | 248 kB | |
withRouter.js gzip | 66.6 kB | 66.6 kB | |
Overall change |
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
buildDuration | 23.3s | 22.6s | -691ms |
nodeModulesSize | 41.3 MB | 42.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.js | 17.8 kB | 17.9 kB | |
main-HASH.js gzip | 6.55 kB | 6.56 kB | |
webpack-HASH.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
commons.HASH.js | 190 kB | 190 kB | ✓ |
commons.HASH.js gzip | 61.6 kB | 61.6 kB | -1 B |
Overall change |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.module.js | 16.1 kB | 16.2 kB | |
main-HASH.module.js gzip | 6.28 kB | 6.28 kB | -7 B |
webpack-HASH.module.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.module.js gzip | 746 B | 746 B | ✓ |
commons.HASH.module.js | 171 kB | 171 kB | ✓ |
commons.HASH.module.js gzip | 55.4 kB | 55.4 kB | ✓ |
Overall change |
Client Pages Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.js | 1.83 kB | 1.9 kB | |
_app.js gzip | 881 B | 905 B | |
_error.js | 12.1 kB | 12.1 kB | ✓ |
_error.js gzip | 4.76 kB | 4.76 kB | ✓ |
hooks.js | 1.06 kB | 1.06 kB | ✓ |
hooks.js gzip | 600 B | 600 B | ✓ |
index.js | 343 B | 343 B | ✓ |
index.js gzip | 237 B | 237 B | ✓ |
link.js | 8.13 kB | 8.13 kB | ✓ |
link.js gzip | 3.49 kB | 3.49 kB | ✓ |
routerDirect.js | 429 B | 429 B | ✓ |
routerDirect.js gzip | 292 B | 292 B | ✓ |
withRouter.js | 439 B | 439 B | ✓ |
withRouter.js gzip | 290 B | 290 B | ✓ |
Overall change |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.module.js | 1.72 kB | 1.79 kB | |
_app.module.js gzip | 838 B | 865 B | |
_error.module.js | 10.6 kB | 10.6 kB | ✓ |
_error.module.js gzip | 4.31 kB | 4.31 kB | ✓ |
hooks.module.js | 596 B | 596 B | ✓ |
hooks.module.js gzip | 354 B | 354 B | ✓ |
index.module.js | 319 B | 319 B | ✓ |
index.module.js gzip | 238 B | 238 B | ✓ |
link.module.js | 8.52 kB | 8.52 kB | ✓ |
link.module.js gzip | 3.67 kB | 3.67 kB | ✓ |
routerDirect.module.js | 417 B | 417 B | ✓ |
routerDirect.module.js gzip | 292 B | 292 B | ✓ |
withRouter.module.js | 427 B | 427 B | ✓ |
withRouter.module.js gzip | 291 B | 291 B | ✓ |
Overall change |
Diffs
Diff for main-HASH.js
@@ -289,7 +289,7 @@ var _interopRequireDefault = __webpack_require__("KI45");
exports.__esModule = true;
exports.render = render;
exports.renderError = renderError;
-exports["default"] = exports.emitter = exports.ErrorComponent = exports.router = exports.dataManager = exports.version = void 0;
+exports["default"] = exports.emitter = exports.ErrorComponent = exports.router = exports.dataManager = void 0;
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__("+oT+"));
@@ -338,13 +338,12 @@ if (!window.Promise) {
var data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent);
window.__NEXT_DATA__ = data;
-var version = "9.0.5";
-exports.version = version;
var props = data.props,
err = data.err,
page = data.page,
query = data.query,
buildId = data.buildId,
+ dynamicBuildId = data.dynamicBuildId,
assetPrefix = data.assetPrefix,
runtimeConfig = data.runtimeConfig,
dynamicIds = data.dynamicIds;
@@ -517,6 +516,8 @@ function () {
return window.__NEXT_PRELOADREADY(dynamicIds);
case 22:
+ if (false) {}
+
exports.router = router = (0, _router.createRouter)(page, query, asPath, {
initialProps: props,
pageLoader: pageLoader,
@@ -547,7 +548,7 @@ function () {
render(renderCtx);
return _context.abrupt("return", emitter);
- case 26:
+ case 27:
case "end":
return _context.stop();
}
@@ -1434,6 +1435,8 @@ var PageLoader =
/*#__PURE__*/
function () {
function PageLoader(buildId, assetPrefix) {
+ var _this3 = this;
+
_classCallCheck(this, PageLoader);
this.buildId = buildId;
@@ -1441,6 +1444,9 @@ function () {
this.pageCache = {};
this.pageRegisterEvents = (0, _mitt["default"])();
this.loadingRoutes = {};
+ this.promisedBuildId = _promise["default"].resolve();
+
+ if (false) {}
if (false) {}
} // Returns a promise for the dependencies for a particular route
@@ -1469,7 +1475,7 @@ function () {
}, {
key: "loadPage",
value: function loadPage(route) {
- var _this3 = this;
+ var _this4 = this;
route = this.normalizeRoute(route);
return new _promise["default"](function (resolve, reject) {
@@ -1477,9 +1483,9 @@ function () {
var error = _ref.error,
page = _ref.page;
- _this3.pageRegisterEvents.off(route, fire);
+ _this4.pageRegisterEvents.off(route, fire);
- delete _this3.loadingRoutes[route];
+ delete _this4.loadingRoutes[route];
if (error) {
reject(error);
@@ -1489,7 +1495,7 @@ function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this3.pageCache[route];
+ var cachedPage = _this4.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1499,7 +1505,7 @@ function () {
} // Register a listener to get the page
- _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1507,11 +1513,11 @@ function () {
return;
}
- if (!_this3.loadingRoutes[route]) {
+ if (!_this4.loadingRoutes[route]) {
if (false) {} else {
- _this3.loadRoute(route);
+ _this4.loadRoute(route);
- _this3.loadingRoutes[route] = true;
+ _this4.loadingRoutes[route] = true;
}
}
});
@@ -1529,13 +1535,22 @@ function () {
while (1) {
switch (_context.prev = _context.next) {
case 0:
+ if (true) {
+ _context.next = 3;
+ break;
+ }
+
+ _context.next = 3;
+ return _this.promisedBuildId;
+
+ case 3:
route = _this.normalizeRoute(route);
scriptRoute = route === '/' ? '/index.js' : route + ".js";
url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
_this.loadScript(url, route, true);
- case 4:
+ case 7:
case "end":
return _context.stop();
}
@@ -1546,7 +1561,7 @@ function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this4 = this;
+ var _this5 = this;
var script = document.createElement('script');
@@ -1564,7 +1579,7 @@ function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1575,7 +1590,7 @@ function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this5 = this;
+ var _this6 = this;
var register = function register() {
try {
@@ -1583,21 +1598,21 @@ function () {
error = _regFn.error,
page = _regFn.page;
- _this5.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error,
page: page
};
- _this5.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error,
page: page
});
} catch (error) {
- _this5.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error
};
- _this5.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1620,6 +1635,15 @@ function () {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
+ if (true) {
+ _context2.next = 3;
+ break;
+ }
+
+ _context2.next = 3;
+ return _this2.promisedBuildId;
+
+ case 3:
route = _this2.normalizeRoute(route);
scriptRoute = (route === '/' ? '/index' : route) + ".js";
@@ -1630,69 +1654,69 @@ function () {
url = isDependency ? route : _this2.assetPrefix + "/_next/static/" + encodeURIComponent(_this2.buildId) + "/pages" + scriptRoute; // n.b. If preload is not supported, we fall back to `loadPage` which has
// its own deduping mechanism.
- if (!document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]")) {
- _context2.next = 6;
+ if (!(document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"]") || document.querySelector("script[data-next-page=\"" + route + "\"]"))) {
+ _context2.next = 9;
break;
}
return _context2.abrupt("return");
- case 6:
+ case 9:
if (!(cn = navigator.connection)) {
- _context2.next = 9;
+ _context2.next = 12;
break;
}
if (!((cn.effectiveType || '').indexOf('2g') !== -1 || cn.saveData)) {
- _context2.next = 9;
+ _context2.next = 12;
break;
}
return _context2.abrupt("return");
- case 9:
+ case 12:
if (true) {
- _context2.next = 15;
+ _context2.next = 18;
break;
}
;
- _context2.next = 13;
+ _context2.next = 16;
return _this2.getDependencies(route);
- case 13:
+ case 16:
_context2.t0 = function (url) {
_this2.prefetch(url, true);
};
_context2.sent.forEach(_context2.t0);
- case 15:
+ case 18:
if (!hasPreload) {
- _context2.next = 18;
+ _context2.next = 21;
break;
}
preloadScript(url);
return _context2.abrupt("return");
- case 18:
+ case 21:
if (!isDependency) {
- _context2.next = 20;
+ _context2.next = 23;
break;
}
return _context2.abrupt("return");
- case 20:
+ case 23:
if (!(document.readyState === 'complete')) {
- _context2.next = 24;
+ _context2.next = 27;
break;
}
return _context2.abrupt("return", _this2.loadPage(route)["catch"](function () {}));
- case 24:
+ case 27:
return _context2.abrupt("return", new _promise["default"](function (resolve) {
window.addEventListener('load', function () {
_this2.loadPage(route).then(function () {
@@ -1703,7 +1727,7 @@ function () {
});
}));
- case 25:
+ case 28:
case "end":
return _context2.stop();
}
Diff for commons.HASH.js
@@ -1287,11 +1287,9 @@ function _loadGetInitialProps() {
throw new Error(_message);
case 15:
- if (false) {}
-
return _context.abrupt("return", props);
- case 17:
+ case 16:
case "end":
return _context.stop();
}
Diff for main-HASH.module.js
@@ -361,7 +361,7 @@ var _interopRequireDefault = __webpack_require__("KI45");
exports.__esModule = true;
exports.render = render;
exports.renderError = renderError;
-exports.default = exports.emitter = exports.ErrorComponent = exports.router = exports.dataManager = exports.version = void 0;
+exports.default = exports.emitter = exports.ErrorComponent = exports.router = exports.dataManager = void 0;
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__("+oT+"));
@@ -410,14 +410,13 @@ if (!window.Promise) {
const data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent);
window.__NEXT_DATA__ = data;
-const version = "9.0.5";
-exports.version = version;
const {
props,
err,
page,
query,
buildId,
+ dynamicBuildId,
assetPrefix,
runtimeConfig,
dynamicIds
@@ -532,6 +531,8 @@ function () {
yield window.__NEXT_PRELOADREADY(dynamicIds);
}
+ if (false) {}
+
exports.router = router = (0, _router.createRouter)(page, query, asPath, {
initialProps: props,
pageLoader,
@@ -1350,6 +1351,9 @@ class PageLoader {
this.pageCache = {};
this.pageRegisterEvents = (0, _mitt.default)();
this.loadingRoutes = {};
+ this.promisedBuildId = _promise.default.resolve();
+
+ if (false) {}
if (false) {}
} // Returns a promise for the dependencies for a particular route
@@ -1420,6 +1424,8 @@ class PageLoader {
var _this = this;
return (0, _asyncToGenerator2.default)(function* () {
+ if (false) {}
+
route = _this.normalizeRoute(route);
let scriptRoute = route === '/' ? '/index.js' : route + ".js";
const url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
@@ -1487,6 +1493,8 @@ class PageLoader {
var _this2 = this;
return (0, _asyncToGenerator2.default)(function* () {
+ if (false) {}
+
route = _this2.normalizeRoute(route);
let scriptRoute = (route === '/' ? '/index' : route) + ".js";
@@ -1497,7 +1505,7 @@ class PageLoader {
const url = isDependency ? route : _this2.assetPrefix + "/_next/static/" + encodeURIComponent(_this2.buildId) + "/pages" + scriptRoute; // n.b. If preload is not supported, we fall back to `loadPage` which has
// its own deduping mechanism.
- if (document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]")) {
+ if (document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"]") || document.querySelector("script[data-next-page=\"" + route + "\"]")) {
return;
} // Inspired by quicklink, license: https://github.com/GoogleChromeLabs/quicklink/blob/master/LICENSE
Diff for commons.HASH.module.js
@@ -668,8 +668,6 @@ async function loadGetInitialProps(Component, ctx) {
throw new Error(message);
}
- if (false) {}
-
return props;
}
Diff for _app.js
@@ -118,7 +118,8 @@ function (_react$default$Compon) {
}]);
return App;
-}(_react["default"].Component);
+}(_react["default"].Component); // @deprecated noop for now until removal
+
exports["default"] = App;
App.childContextTypes = {
@@ -126,17 +127,15 @@ App.childContextTypes = {
};
App.origGetInitialProps = appGetInitialProps;
App.getInitialProps = appGetInitialProps;
-var warnContainer;
-var warnUrl;
-
-if (false) {} // @deprecated noop for now until removal
-
function Container(p) {
- if (false) {}
return p.children;
}
+var warnUrl = (0, _utils.execOnce)(function () {
+ if (false) {}
+});
+
function createUrl(router) {
// This is to make sure we don't references the router object at call time
var pathname = router.pathname,
@@ -144,40 +143,40 @@ function createUrl(router) {
query = router.query;
return {
get query() {
- if (false) {}
+ warnUrl();
return query;
},
get pathname() {
- if (false) {}
+ warnUrl();
return pathname;
},
get asPath() {
- if (false) {}
+ warnUrl();
return asPath;
},
back: function back() {
- if (false) {}
+ warnUrl();
router.back();
},
push: function push(url, as) {
- if (false) {}
+ warnUrl();
return router.push(url, as);
},
pushTo: function pushTo(href, as) {
- if (false) {}
+ warnUrl();
var pushRoute = as ? href : '';
var pushUrl = as || href;
return router.push(pushRoute, pushUrl);
},
replace: function replace(url, as) {
- if (false) {}
+ warnUrl();
return router.replace(url, as);
},
replaceTo: function replaceTo(href, as) {
- if (false) {}
+ warnUrl();
var replaceRoute = as ? href : '';
var replaceUrl = as || href;
return router.replace(replaceRoute, replaceUrl);
Diff for _app.module.js
@@ -121,7 +121,8 @@ class App extends _react.default.Component {
}));
}
-}
+} // @deprecated noop for now until removal
+
exports.default = App;
App.childContextTypes = {
@@ -129,17 +130,15 @@ App.childContextTypes = {
};
App.origGetInitialProps = appGetInitialProps;
App.getInitialProps = appGetInitialProps;
-let warnContainer;
-let warnUrl;
-
-if (false) {} // @deprecated noop for now until removal
-
function Container(p) {
- if (false) {}
return p.children;
}
+const warnUrl = (0, _utils.execOnce)(() => {
+ if (false) {}
+});
+
function createUrl(router) {
// This is to make sure we don't references the router object at call time
const {
@@ -149,40 +148,40 @@ function createUrl(router) {
} = router;
return {
get query() {
- if (false) {}
+ warnUrl();
return query;
},
get pathname() {
- if (false) {}
+ warnUrl();
return pathname;
},
get asPath() {
- if (false) {}
+ warnUrl();
return asPath;
},
back: () => {
- if (false) {}
+ warnUrl();
router.back();
},
push: (url, as) => {
- if (false) {}
+ warnUrl();
return router.push(url, as);
},
pushTo: (href, as) => {
- if (false) {}
+ warnUrl();
const pushRoute = as ? href : '';
const pushUrl = as || href;
return router.push(pushRoute, pushUrl);
},
replace: (url, as) => {
- if (false) {}
+ warnUrl();
return router.replace(url, as);
},
replaceTo: (href, as) => {
- if (false) {}
+ warnUrl();
const replaceRoute = as ? href : '';
const replaceUrl = as || href;
return router.replace(replaceRoute, replaceUrl);
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
buildDuration | 23.7s | 24.3s | |
nodeModulesSize | 41.3 MB | 42.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.js | 17.8 kB | 17.9 kB | |
main-HASH.js gzip | 6.55 kB | 6.56 kB | |
webpack-HASH.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
commons.HASH.js | 190 kB | 190 kB | ✓ |
commons.HASH.js gzip | 61.6 kB | 61.6 kB | -1 B |
Overall change |
Client Bundles (main, webpack, commons) Modern Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.module.js | 16.1 kB | 16.2 kB | |
main-HASH.module.js gzip | 6.28 kB | 6.28 kB | -7 B |
webpack-HASH.module.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.module.js gzip | 746 B | 746 B | ✓ |
commons.HASH.module.js | 171 kB | 171 kB | ✓ |
commons.HASH.module.js gzip | 55.4 kB | 55.4 kB | ✓ |
Overall change |
Client Pages Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.js | 1.83 kB | 1.9 kB | |
_app.js gzip | 881 B | 905 B | |
_error.js | 12.1 kB | 12.1 kB | ✓ |
_error.js gzip | 4.76 kB | 4.76 kB | ✓ |
hooks.js | 1.06 kB | 1.06 kB | ✓ |
hooks.js gzip | 600 B | 600 B | ✓ |
index.js | 343 B | 343 B | ✓ |
index.js gzip | 237 B | 237 B | ✓ |
link.js | 8.13 kB | 8.13 kB | ✓ |
link.js gzip | 3.49 kB | 3.49 kB | ✓ |
routerDirect.js | 429 B | 429 B | ✓ |
routerDirect.js gzip | 292 B | 292 B | ✓ |
withRouter.js | 439 B | 439 B | ✓ |
withRouter.js gzip | 290 B | 290 B | ✓ |
Overall change |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.module.js | 1.72 kB | 1.79 kB | |
_app.module.js gzip | 838 B | 865 B | |
_error.module.js | 10.6 kB | 10.6 kB | ✓ |
_error.module.js gzip | 4.31 kB | 4.31 kB | ✓ |
hooks.module.js | 596 B | 596 B | ✓ |
hooks.module.js gzip | 354 B | 354 B | ✓ |
index.module.js | 319 B | 319 B | ✓ |
index.module.js gzip | 238 B | 238 B | ✓ |
link.module.js | 8.52 kB | 8.52 kB | ✓ |
link.module.js gzip | 3.67 kB | 3.67 kB | ✓ |
routerDirect.module.js | 417 B | 417 B | ✓ |
routerDirect.module.js gzip | 292 B | 292 B | ✓ |
withRouter.module.js | 427 B | 427 B | ✓ |
withRouter.module.js gzip | 291 B | 291 B | ✓ |
Overall change |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_error.js | 246 kB | 247 kB | |
_error.js gzip | 66.1 kB | 66.3 kB | |
hooks.html | 2.85 kB | 2.87 kB | |
hooks.html gzip | 854 B | 866 B | |
index.js | 247 kB | 248 kB | |
index.js gzip | 66.6 kB | 66.6 kB | |
link.js | 254 kB | 255 kB | |
link.js gzip | 68.7 kB | 68.8 kB | |
routerDirect.js | 247 kB | 248 kB | |
routerDirect.js gzip | 66.6 kB | 66.5 kB | -83 B |
withRouter.js | 247 kB | 248 kB | |
withRouter.js gzip | 66.5 kB | 66.6 kB | |
Overall change |
Blocked by vercel/webpack-asset-relocator-loader#69 |
Stats from current PRDefault Server Mode (Increase detected
|
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
buildDuration | 22.6s | 22.4s | -284ms |
nodeModulesSize | 41.8 MB | 42.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.js | 17.8 kB | 17.9 kB | |
main-HASH.js gzip | 6.56 kB | 6.56 kB | |
webpack-HASH.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
commons.HASH.js | 190 kB | 190 kB | -46 B |
commons.HASH.js gzip | 61.6 kB | 61.6 kB | -20 B |
Overall change |
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.module.js | 16.2 kB | 16.2 kB | |
main-HASH.module.js gzip | 6.28 kB | 6.28 kB | -9 B |
webpack-HASH.module.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.module.js gzip | 746 B | 746 B | ✓ |
commons.HASH.module.js | 171 kB | 171 kB | -46 B |
commons.HASH.module.js gzip | 55.4 kB | 55.4 kB | -15 B |
Overall change | -9 B |
Client Pages Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.js | 1.83 kB | 1.9 kB | |
_app.js gzip | 881 B | 905 B | |
_error.js | 12.1 kB | 12.1 kB | ✓ |
_error.js gzip | 4.76 kB | 4.76 kB | ✓ |
hooks.js | 1.06 kB | 1.06 kB | ✓ |
hooks.js gzip | 601 B | 600 B | -1 B |
index.js | 343 B | 343 B | ✓ |
index.js gzip | 237 B | 237 B | ✓ |
link.js | 8.13 kB | 8.13 kB | ✓ |
link.js gzip | 3.49 kB | 3.49 kB | |
routerDirect.js | 429 B | 429 B | ✓ |
routerDirect.js gzip | 292 B | 292 B | ✓ |
withRouter.js | 439 B | 439 B | ✓ |
withRouter.js gzip | 289 B | 290 B | |
Overall change |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.module.js | 1.72 kB | 1.79 kB | |
_app.module.js gzip | 838 B | 865 B | |
_error.module.js | 10.6 kB | 10.6 kB | ✓ |
_error.module.js gzip | 4.31 kB | 4.31 kB | ✓ |
hooks.module.js | 596 B | 596 B | ✓ |
hooks.module.js gzip | 354 B | 354 B | ✓ |
index.module.js | 319 B | 319 B | ✓ |
index.module.js gzip | 238 B | 238 B | ✓ |
link.module.js | 8.52 kB | 8.52 kB | ✓ |
link.module.js gzip | 3.67 kB | 3.67 kB | ✓ |
routerDirect.module.js | 417 B | 417 B | ✓ |
routerDirect.module.js gzip | 292 B | 292 B | ✓ |
withRouter.module.js | 427 B | 427 B | ✓ |
withRouter.module.js gzip | 291 B | 291 B | ✓ |
Overall change |
Diffs
Diff for main-HASH.js
@@ -289,7 +289,7 @@ var _interopRequireDefault = __webpack_require__("KI45");
exports.__esModule = true;
exports.render = render;
exports.renderError = renderError;
-exports["default"] = exports.emitter = exports.ErrorComponent = exports.router = exports.dataManager = exports.version = void 0;
+exports["default"] = exports.emitter = exports.ErrorComponent = exports.router = exports.dataManager = void 0;
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__("+oT+"));
@@ -338,13 +338,12 @@ if (!window.Promise) {
var data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent);
window.__NEXT_DATA__ = data;
-var version = "9.0.5";
-exports.version = version;
var props = data.props,
err = data.err,
page = data.page,
query = data.query,
buildId = data.buildId,
+ dynamicBuildId = data.dynamicBuildId,
assetPrefix = data.assetPrefix,
runtimeConfig = data.runtimeConfig,
dynamicIds = data.dynamicIds;
@@ -517,6 +516,8 @@ function () {
return window.__NEXT_PRELOADREADY(dynamicIds);
case 22:
+ if (false) {}
+
exports.router = router = (0, _router.createRouter)(page, query, asPath, {
initialProps: props,
pageLoader: pageLoader,
@@ -547,7 +548,7 @@ function () {
render(renderCtx);
return _context.abrupt("return", emitter);
- case 26:
+ case 27:
case "end":
return _context.stop();
}
@@ -1425,7 +1426,7 @@ function preloadScript(url) {
var link = document.createElement('link');
link.rel = 'preload';
link.crossOrigin = "anonymous";
- link.href = encodeURI(url);
+ link.href = url;
link.as = 'script';
document.head.appendChild(link);
}
@@ -1434,6 +1435,8 @@ var PageLoader =
/*#__PURE__*/
function () {
function PageLoader(buildId, assetPrefix) {
+ var _this3 = this;
+
_classCallCheck(this, PageLoader);
this.buildId = buildId;
@@ -1441,6 +1444,9 @@ function () {
this.pageCache = {};
this.pageRegisterEvents = (0, _mitt["default"])();
this.loadingRoutes = {};
+ this.promisedBuildId = _promise["default"].resolve();
+
+ if (false) {}
if (false) {}
} // Returns a promise for the dependencies for a particular route
@@ -1469,7 +1475,7 @@ function () {
}, {
key: "loadPage",
value: function loadPage(route) {
- var _this3 = this;
+ var _this4 = this;
route = this.normalizeRoute(route);
return new _promise["default"](function (resolve, reject) {
@@ -1477,9 +1483,9 @@ function () {
var error = _ref.error,
page = _ref.page;
- _this3.pageRegisterEvents.off(route, fire);
+ _this4.pageRegisterEvents.off(route, fire);
- delete _this3.loadingRoutes[route];
+ delete _this4.loadingRoutes[route];
if (error) {
reject(error);
@@ -1489,7 +1495,7 @@ function () {
}; // If there's a cached version of the page, let's use it.
- var cachedPage = _this3.pageCache[route];
+ var cachedPage = _this4.pageCache[route];
if (cachedPage) {
var error = cachedPage.error,
@@ -1499,7 +1505,7 @@ function () {
} // Register a listener to get the page
- _this3.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
+ _this4.pageRegisterEvents.on(route, fire); // If the page is loading via SSR, we need to wait for it
// rather downloading it again.
@@ -1507,11 +1513,11 @@ function () {
return;
}
- if (!_this3.loadingRoutes[route]) {
+ if (!_this4.loadingRoutes[route]) {
if (false) {} else {
- _this3.loadRoute(route);
+ _this4.loadRoute(route);
- _this3.loadingRoutes[route] = true;
+ _this4.loadingRoutes[route] = true;
}
}
});
@@ -1529,13 +1535,22 @@ function () {
while (1) {
switch (_context.prev = _context.next) {
case 0:
+ if (true) {
+ _context.next = 3;
+ break;
+ }
+
+ _context.next = 3;
+ return _this.promisedBuildId;
+
+ case 3:
route = _this.normalizeRoute(route);
scriptRoute = route === '/' ? '/index.js' : route + ".js";
url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
_this.loadScript(url, route, true);
- case 4:
+ case 7:
case "end":
return _context.stop();
}
@@ -1546,7 +1561,7 @@ function () {
}, {
key: "loadScript",
value: function loadScript(url, route, isPage) {
- var _this4 = this;
+ var _this5 = this;
var script = document.createElement('script');
@@ -1558,13 +1573,13 @@ function () {
}
script.crossOrigin = "anonymous";
- script.src = encodeURI(url);
+ script.src = url;
script.onerror = function () {
var error = new Error("Error loading script " + url);
error.code = 'PAGE_LOAD_ERROR';
- _this4.pageRegisterEvents.emit(route, {
+ _this5.pageRegisterEvents.emit(route, {
error: error
});
};
@@ -1575,7 +1590,7 @@ function () {
}, {
key: "registerPage",
value: function registerPage(route, regFn) {
- var _this5 = this;
+ var _this6 = this;
var register = function register() {
try {
@@ -1583,21 +1598,21 @@ function () {
error = _regFn.error,
page = _regFn.page;
- _this5.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error,
page: page
};
- _this5.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error,
page: page
});
} catch (error) {
- _this5.pageCache[route] = {
+ _this6.pageCache[route] = {
error: error
};
- _this5.pageRegisterEvents.emit(route, {
+ _this6.pageRegisterEvents.emit(route, {
error: error
});
}
@@ -1620,6 +1635,15 @@ function () {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
+ if (true) {
+ _context2.next = 3;
+ break;
+ }
+
+ _context2.next = 3;
+ return _this2.promisedBuildId;
+
+ case 3:
route = _this2.normalizeRoute(route);
scriptRoute = (route === '/' ? '/index' : route) + ".js";
@@ -1630,69 +1654,69 @@ function () {
url = isDependency ? route : _this2.assetPrefix + "/_next/static/" + encodeURIComponent(_this2.buildId) + "/pages" + scriptRoute; // n.b. If preload is not supported, we fall back to `loadPage` which has
// its own deduping mechanism.
- if (!document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]")) {
- _context2.next = 6;
+ if (!(document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"]") || document.querySelector("script[data-next-page=\"" + route + "\"]"))) {
+ _context2.next = 9;
break;
}
return _context2.abrupt("return");
- case 6:
+ case 9:
if (!(cn = navigator.connection)) {
- _context2.next = 9;
+ _context2.next = 12;
break;
}
if (!((cn.effectiveType || '').indexOf('2g') !== -1 || cn.saveData)) {
- _context2.next = 9;
+ _context2.next = 12;
break;
}
return _context2.abrupt("return");
- case 9:
+ case 12:
if (true) {
- _context2.next = 15;
+ _context2.next = 18;
break;
}
;
- _context2.next = 13;
+ _context2.next = 16;
return _this2.getDependencies(route);
- case 13:
+ case 16:
_context2.t0 = function (url) {
_this2.prefetch(url, true);
};
_context2.sent.forEach(_context2.t0);
- case 15:
+ case 18:
if (!hasPreload) {
- _context2.next = 18;
+ _context2.next = 21;
break;
}
preloadScript(url);
return _context2.abrupt("return");
- case 18:
+ case 21:
if (!isDependency) {
- _context2.next = 20;
+ _context2.next = 23;
break;
}
return _context2.abrupt("return");
- case 20:
+ case 23:
if (!(document.readyState === 'complete')) {
- _context2.next = 24;
+ _context2.next = 27;
break;
}
return _context2.abrupt("return", _this2.loadPage(route)["catch"](function () {}));
- case 24:
+ case 27:
return _context2.abrupt("return", new _promise["default"](function (resolve) {
window.addEventListener('load', function () {
_this2.loadPage(route).then(function () {
@@ -1703,7 +1727,7 @@ function () {
});
}));
- case 25:
+ case 28:
case "end":
return _context2.stop();
}
Diff for commons.HASH.js
@@ -1287,11 +1287,9 @@ function _loadGetInitialProps() {
throw new Error(_message);
case 15:
- if (false) {}
-
return _context.abrupt("return", props);
- case 17:
+ case 16:
case "end":
return _context.stop();
}
@@ -3308,7 +3306,7 @@ function () {
var routeMatch = route_matcher_1.getRouteMatcher(rr)(asPathname);
if (!routeMatch) {
- console.error('The provided `as` value is incompatible with the `href` value. This is invalid. https://err.sh/zeit/next.js/incompatible-href-as');
+ console.error("Your `<Link>`'s `as` value is incompatible with the `href` value. This is invalid.");
return resolve(false);
} // Merge params into `query`, overwriting any specified in search
Diff for main-HASH.module.js
@@ -361,7 +361,7 @@ var _interopRequireDefault = __webpack_require__("KI45");
exports.__esModule = true;
exports.render = render;
exports.renderError = renderError;
-exports.default = exports.emitter = exports.ErrorComponent = exports.router = exports.dataManager = exports.version = void 0;
+exports.default = exports.emitter = exports.ErrorComponent = exports.router = exports.dataManager = void 0;
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__("+oT+"));
@@ -410,14 +410,13 @@ if (!window.Promise) {
const data = JSON.parse(document.getElementById('__NEXT_DATA__').textContent);
window.__NEXT_DATA__ = data;
-const version = "9.0.5";
-exports.version = version;
const {
props,
err,
page,
query,
buildId,
+ dynamicBuildId,
assetPrefix,
runtimeConfig,
dynamicIds
@@ -532,6 +531,8 @@ function () {
yield window.__NEXT_PRELOADREADY(dynamicIds);
}
+ if (false) {}
+
exports.router = router = (0, _router.createRouter)(page, query, asPath, {
initialProps: props,
pageLoader,
@@ -1338,7 +1339,7 @@ function preloadScript(url) {
const link = document.createElement('link');
link.rel = 'preload';
link.crossOrigin = "anonymous";
- link.href = encodeURI(url);
+ link.href = url;
link.as = 'script';
document.head.appendChild(link);
}
@@ -1350,6 +1351,9 @@ class PageLoader {
this.pageCache = {};
this.pageRegisterEvents = (0, _mitt.default)();
this.loadingRoutes = {};
+ this.promisedBuildId = _promise.default.resolve();
+
+ if (false) {}
if (false) {}
} // Returns a promise for the dependencies for a particular route
@@ -1420,6 +1424,8 @@ class PageLoader {
var _this = this;
return (0, _asyncToGenerator2.default)(function* () {
+ if (false) {}
+
route = _this.normalizeRoute(route);
let scriptRoute = route === '/' ? '/index.js' : route + ".js";
const url = _this.assetPrefix + "/_next/static/" + encodeURIComponent(_this.buildId) + "/pages" + scriptRoute;
@@ -1439,7 +1445,7 @@ class PageLoader {
}
script.crossOrigin = "anonymous";
- script.src = encodeURI(url);
+ script.src = url;
script.onerror = () => {
const error = new Error("Error loading script " + url);
@@ -1487,6 +1493,8 @@ class PageLoader {
var _this2 = this;
return (0, _asyncToGenerator2.default)(function* () {
+ if (false) {}
+
route = _this2.normalizeRoute(route);
let scriptRoute = (route === '/' ? '/index' : route) + ".js";
@@ -1497,7 +1505,7 @@ class PageLoader {
const url = isDependency ? route : _this2.assetPrefix + "/_next/static/" + encodeURIComponent(_this2.buildId) + "/pages" + scriptRoute; // n.b. If preload is not supported, we fall back to `loadPage` which has
// its own deduping mechanism.
- if (document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"], script[data-next-page=\"" + route + "\"]")) {
+ if (document.querySelector("link[rel=\"preload\"][href^=\"" + url + "\"]") || document.querySelector("script[data-next-page=\"" + route + "\"]")) {
return;
} // Inspired by quicklink, license: https://github.com/GoogleChromeLabs/quicklink/blob/master/LICENSE
Diff for commons.HASH.module.js
@@ -668,8 +668,6 @@ async function loadGetInitialProps(Component, ctx) {
throw new Error(message);
}
- if (false) {}
-
return props;
}
@@ -2639,7 +2637,7 @@ class Router {
const routeMatch = route_matcher_1.getRouteMatcher(rr)(asPathname);
if (!routeMatch) {
- console.error('The provided `as` value is incompatible with the `href` value. This is invalid. https://err.sh/zeit/next.js/incompatible-href-as');
+ console.error("Your `<Link>`'s `as` value is incompatible with the `href` value. This is invalid.");
return resolve(false);
} // Merge params into `query`, overwriting any specified in search
Diff for _app.js
@@ -118,7 +118,8 @@ function (_react$default$Compon) {
}]);
return App;
-}(_react["default"].Component);
+}(_react["default"].Component); // @deprecated noop for now until removal
+
exports["default"] = App;
App.childContextTypes = {
@@ -126,17 +127,15 @@ App.childContextTypes = {
};
App.origGetInitialProps = appGetInitialProps;
App.getInitialProps = appGetInitialProps;
-var warnContainer;
-var warnUrl;
-
-if (false) {} // @deprecated noop for now until removal
-
function Container(p) {
- if (false) {}
return p.children;
}
+var warnUrl = (0, _utils.execOnce)(function () {
+ if (false) {}
+});
+
function createUrl(router) {
// This is to make sure we don't references the router object at call time
var pathname = router.pathname,
@@ -144,40 +143,40 @@ function createUrl(router) {
query = router.query;
return {
get query() {
- if (false) {}
+ warnUrl();
return query;
},
get pathname() {
- if (false) {}
+ warnUrl();
return pathname;
},
get asPath() {
- if (false) {}
+ warnUrl();
return asPath;
},
back: function back() {
- if (false) {}
+ warnUrl();
router.back();
},
push: function push(url, as) {
- if (false) {}
+ warnUrl();
return router.push(url, as);
},
pushTo: function pushTo(href, as) {
- if (false) {}
+ warnUrl();
var pushRoute = as ? href : '';
var pushUrl = as || href;
return router.push(pushRoute, pushUrl);
},
replace: function replace(url, as) {
- if (false) {}
+ warnUrl();
return router.replace(url, as);
},
replaceTo: function replaceTo(href, as) {
- if (false) {}
+ warnUrl();
var replaceRoute = as ? href : '';
var replaceUrl = as || href;
return router.replace(replaceRoute, replaceUrl);
Diff for _app.module.js
@@ -121,7 +121,8 @@ class App extends _react.default.Component {
}));
}
-}
+} // @deprecated noop for now until removal
+
exports.default = App;
App.childContextTypes = {
@@ -129,17 +130,15 @@ App.childContextTypes = {
};
App.origGetInitialProps = appGetInitialProps;
App.getInitialProps = appGetInitialProps;
-let warnContainer;
-let warnUrl;
-
-if (false) {} // @deprecated noop for now until removal
-
function Container(p) {
- if (false) {}
return p.children;
}
+const warnUrl = (0, _utils.execOnce)(() => {
+ if (false) {}
+});
+
function createUrl(router) {
// This is to make sure we don't references the router object at call time
const {
@@ -149,40 +148,40 @@ function createUrl(router) {
} = router;
return {
get query() {
- if (false) {}
+ warnUrl();
return query;
},
get pathname() {
- if (false) {}
+ warnUrl();
return pathname;
},
get asPath() {
- if (false) {}
+ warnUrl();
return asPath;
},
back: () => {
- if (false) {}
+ warnUrl();
router.back();
},
push: (url, as) => {
- if (false) {}
+ warnUrl();
return router.push(url, as);
},
pushTo: (href, as) => {
- if (false) {}
+ warnUrl();
const pushRoute = as ? href : '';
const pushUrl = as || href;
return router.push(pushRoute, pushUrl);
},
replace: (url, as) => {
- if (false) {}
+ warnUrl();
return router.replace(url, as);
},
replaceTo: (href, as) => {
- if (false) {}
+ warnUrl();
const replaceRoute = as ? href : '';
const replaceUrl = as || href;
return router.replace(replaceRoute, replaceUrl);
Serverless Mode (Increase detected ⚠️ )
General Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
buildDuration | 23.1s | 24.8s | |
nodeModulesSize | 41.8 MB | 42.7 MB |
Client Bundles (main, webpack, commons) Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.js | 17.8 kB | 17.9 kB | |
main-HASH.js gzip | 6.56 kB | 6.56 kB | |
webpack-HASH.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.js gzip | 746 B | 746 B | ✓ |
commons.HASH.js | 190 kB | 190 kB | -46 B |
commons.HASH.js gzip | 61.6 kB | 61.6 kB | -20 B |
Overall change |
Client Bundles (main, webpack, commons) Modern Overall decrease ✓
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
main-HASH.module.js | 16.2 kB | 16.2 kB | |
main-HASH.module.js gzip | 6.29 kB | 6.28 kB | -10 B |
webpack-HASH.module.js | 1.53 kB | 1.53 kB | ✓ |
webpack-HASH.module.js gzip | 746 B | 746 B | ✓ |
commons.HASH.module.js | 171 kB | 171 kB | -46 B |
commons.HASH.module.js gzip | 55.4 kB | 55.4 kB | -15 B |
Overall change | -9 B |
Client Pages Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.js | 1.83 kB | 1.9 kB | |
_app.js gzip | 881 B | 905 B | |
_error.js | 12.1 kB | 12.1 kB | ✓ |
_error.js gzip | 4.76 kB | 4.76 kB | ✓ |
hooks.js | 1.06 kB | 1.06 kB | ✓ |
hooks.js gzip | 600 B | 600 B | ✓ |
index.js | 343 B | 343 B | ✓ |
index.js gzip | 237 B | 237 B | ✓ |
link.js | 8.13 kB | 8.13 kB | ✓ |
link.js gzip | 3.49 kB | 3.49 kB | ✓ |
routerDirect.js | 429 B | 429 B | ✓ |
routerDirect.js gzip | 292 B | 292 B | ✓ |
withRouter.js | 439 B | 439 B | ✓ |
withRouter.js gzip | 290 B | 290 B | ✓ |
Overall change |
Client Pages Modern Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_app.module.js | 1.72 kB | 1.79 kB | |
_app.module.js gzip | 838 B | 865 B | |
_error.module.js | 10.6 kB | 10.6 kB | ✓ |
_error.module.js gzip | 4.31 kB | 4.31 kB | ✓ |
hooks.module.js | 596 B | 596 B | ✓ |
hooks.module.js gzip | 354 B | 354 B | ✓ |
index.module.js | 319 B | 319 B | ✓ |
index.module.js gzip | 238 B | 238 B | ✓ |
link.module.js | 8.52 kB | 8.52 kB | ✓ |
link.module.js gzip | 3.67 kB | 3.67 kB | ✓ |
routerDirect.module.js | 417 B | 417 B | ✓ |
routerDirect.module.js gzip | 292 B | 292 B | ✓ |
withRouter.module.js | 427 B | 427 B | ✓ |
withRouter.module.js gzip | 291 B | 291 B | ✓ |
Overall change |
Serverless bundles Overall increase ⚠️
zeit/next.js canary | huv1k/next.js dirname-fix | Change | |
---|---|---|---|
_error.js | 246 kB | 247 kB | |
_error.js gzip | 66.1 kB | 66.3 kB | |
hooks.html | 2.85 kB | 2.87 kB | |
hooks.html gzip | 851 B | 865 B | |
index.js | 247 kB | 248 kB | |
index.js gzip | 66.5 kB | 66.6 kB | |
link.js | 254 kB | 255 kB | |
link.js gzip | 68.7 kB | 68.8 kB | |
routerDirect.js | 248 kB | 248 kB | |
routerDirect.js gzip | 66.4 kB | 66.5 kB | |
withRouter.js | 248 kB | 248 kB | |
withRouter.js gzip | 66.7 kB | 66.6 kB | -11 B |
Overall change |
Very excited for this feature. My API involves reading and writing files so this will be great. |
Closing this as we decided to go with a simpler variant that doesn't parse the webpack output. We'll post updates here when we have movement on it. |
Thanks @Timer! Is there a rough ETA? Like before EOY or whenever more people ask for it? |
I've de-prioritized this work as we're currently focused on other improvements that have more impact than this change and this change is quite tricky to get right (would require quite a bit of maintenance overhead). |
That makes sense, I'll make sure to build a separate lambda that handles the file reading, then. Thanks for the honesty, @timneutkens! |
Feel free to take on this issue / investigate a solution btw! |
Would you be willing to share your thoughts on:
? I'm happy to try and implement something with very few pointers. This PR actually seemed like a pretty simple solution to me, so I'm probably missing a ton of context. |
Any updates on this? just migrated my API to Now serverless, and encounter this problem when using Prisma2, don't want to change my deployment solution. |
this is quite an impactful piece of next.js, the whole /api/ capability, without this no one can serve xml pages etc on production builds... Quite a limitation for next.js over php... |
Why was closed and what is the other option @Timer |
This is currently in progress: #25538 |
This PR fix problem with
__dirname
, where__dirname
is/
instead of the actual working directory. This changes__dirname
to the relative path to the source file. This simulates actual behavior of__dirname
.Fixes #8251