()
| 1545 | } |
| 1546 | |
| 1547 | private async loadNodeMiddleware() { |
| 1548 | if (!process.env.NEXT_MINIMAL) { |
| 1549 | try { |
| 1550 | const functionsConfig = this.dev |
| 1551 | ? {} |
| 1552 | : require( |
| 1553 | join( |
| 1554 | /* turbopackIgnore: true */ this.distDir, |
| 1555 | 'server', |
| 1556 | FUNCTIONS_CONFIG_MANIFEST |
| 1557 | ) |
| 1558 | ) |
| 1559 | |
| 1560 | if (this.dev || functionsConfig?.functions?.['/_middleware']) { |
| 1561 | // if used with top level await, this will be a promise |
| 1562 | return require( |
| 1563 | join( |
| 1564 | /* turbopackIgnore: true */ this.distDir, |
| 1565 | 'server', |
| 1566 | 'middleware.js' |
| 1567 | ) |
| 1568 | ) |
| 1569 | } |
| 1570 | } catch (err) { |
| 1571 | if ( |
| 1572 | isError(err) && |
| 1573 | err.code !== 'ENOENT' && |
| 1574 | err.code !== 'MODULE_NOT_FOUND' |
| 1575 | ) { |
| 1576 | throw err |
| 1577 | } |
| 1578 | } |
| 1579 | } |
| 1580 | } |
| 1581 | |
| 1582 | /** |
| 1583 | * Checks if a middleware exists. This method is useful for the development |
no test coverage detected