mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Fixes https://github.com/vercel/next.js/issues/54245 https://nextjs.org/docs/app/api-reference/next-config-js/output#caveats Currently, `outputFileTracingExcludes`/`outputFileTracingIncludes` only works with Pages router. This PR adds support for App router.
33 lines
811 B
JavaScript
33 lines
811 B
JavaScript
const path = require('path')
|
|
|
|
module.exports = {
|
|
webpack(cfg, { isServer, nextRuntime }) {
|
|
console.log(cfg.entry)
|
|
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,
|
|
]
|
|
console.log(origEntries)
|
|
}
|
|
return origEntries
|
|
}
|
|
return cfg
|
|
},
|
|
experimental: {
|
|
outputFileTracingIncludes: {
|
|
'/index': ['include-me/**/*'],
|
|
'/route1': ['include-me/**/*'],
|
|
},
|
|
outputFileTracingExcludes: {
|
|
'/index': ['public/exclude-me/**/*'],
|
|
'/route1': ['public/exclude-me/**/*'],
|
|
},
|
|
},
|
|
}
|