mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
These are effectively the tests for https://github.com/vercel/next.js/pull/82906 `outputFileTracingIncludes` and `outputFileTracingExcludes` match not against the pathname of the routes, but also include the app/pages prefix, e.g. `app/route1` for `src/app/route1/route.js` (at least the Webpack implementation does, which is what we're replicating here).
32 lines
876 B
JavaScript
32 lines
876 B
JavaScript
const path = require('path')
|
|
|
|
module.exports = {
|
|
webpack(cfg, { isServer, nextRuntime }) {
|
|
const origEntry = cfg.entry
|
|
cfg.entry = async () => {
|
|
const origEntries = await origEntry()
|
|
|
|
if (isServer && nextRuntime === 'nodejs') {
|
|
const curEntry = origEntries['pages/_app']
|
|
origEntries['pages/_app'] = [
|
|
path.join(__dirname, 'lib/get-data.js'),
|
|
...curEntry,
|
|
]
|
|
}
|
|
return origEntries
|
|
}
|
|
return cfg
|
|
},
|
|
outputFileTracingIncludes: {
|
|
// Full path includes "app" or "pages"
|
|
'/pages/index': ['include-me/**/*'],
|
|
'/app/route1': ['./include-me/**/*', 'node_modules/pkg-behind-symlink/*'],
|
|
'/*': ['include-me-global.txt'],
|
|
},
|
|
outputFileTracingExcludes: {
|
|
// Subpaths should also work
|
|
'/index': ['public/exclude-me/**/*'],
|
|
'/route1': ['./public/exclude-me/**/*'],
|
|
},
|
|
}
|