Include frameworks in main-app (#41465)
There is no need to have a separate `framework` chunk for React and React DOM, as they're already included in the `main-app` entry. With this PR, React and React DOM will be included in `main-app` directly and app is no longer depending on the `framework` chunk. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## 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` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
This commit is contained in:
parent
7be2ef0fcf
commit
a75b323877
1 changed files with 17 additions and 2 deletions
|
@ -1338,10 +1338,25 @@ export default async function getBaseWebpackConfig(
|
||||||
// and all other chunk depend on them so there is no
|
// and all other chunk depend on them so there is no
|
||||||
// duplication that need to be pulled out.
|
// duplication that need to be pulled out.
|
||||||
chunks: (chunk: any) =>
|
chunks: (chunk: any) =>
|
||||||
!/^(polyfills|main|pages\/_app)$/.test(chunk.name),
|
!/^(polyfills|main|main-app|pages\/_app)$/.test(chunk.name),
|
||||||
cacheGroups: {
|
cacheGroups: {
|
||||||
framework: {
|
framework: {
|
||||||
chunks: 'all',
|
chunks: (chunk) => {
|
||||||
|
const name = chunk.name
|
||||||
|
|
||||||
|
// Skip app directory and include shared modules in main-app.
|
||||||
|
if (
|
||||||
|
name &&
|
||||||
|
hasAppDir &&
|
||||||
|
(name === 'main-app' ||
|
||||||
|
name === 'app-internals' ||
|
||||||
|
name.startsWith('app/'))
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
},
|
||||||
name: 'framework',
|
name: 'framework',
|
||||||
test(module: any) {
|
test(module: any) {
|
||||||
const resource = module.nameForCondition?.()
|
const resource = module.nameForCondition?.()
|
||||||
|
|
Loading…
Reference in a new issue