mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
This adds a top-level experimental config for including/excluding files from the file traces. This replaces the page level `unstable_includeFiles`/`unstable_excludeFiles` as those had some drawbacks such as not being supported for API routes as these files aren't required during build to gather the configs, having to duplicate includes/excludes for multiple pages, and causing more confusion for where the globs were meant to be relative to. The new top-level configs allow mapping page globs to includes/excludes so they can be shared across multiple pages or a single page. These can also affect the `next-server` trace by specifying that as the key if necessary. The previous `outputFileTraceIgnores` config is automatically mapped to the new config with a deprecation warning. ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added - [x] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
36 lines
875 B
JavaScript
36 lines
875 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/*'],
|
|
},
|
|
outputFileTracingExcludes: {
|
|
'/index': ['public/exclude-me/**/*'],
|
|
},
|
|
turbotrace: {
|
|
contextDirectory: path.join(__dirname, '..', '..', '..', '..'),
|
|
memoryLimit: 2048,
|
|
},
|
|
webpackBuildWorker: true,
|
|
},
|
|
}
|