Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
optoutServerComponentsBundle
option (#40770)
Follow-up for #40739 to add an option to opt-out specific packages from being bundled. ## 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` - [x] 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)
- Loading branch information
Showing
11 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
test/e2e/app-dir/rsc-basic/app/react-server/optout/client.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'client' | ||
|
||
import v from 'conditional-exports-optout' | ||
import v1 from 'conditional-exports-optout/subpath' | ||
|
||
export default function Client() { | ||
return ( | ||
<> | ||
{`Client: ${v}`} | ||
<br /> | ||
{`Client subpath: ${v1}`} | ||
<br /> | ||
</> | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
test/e2e/app-dir/rsc-basic/app/react-server/optout/page.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import v from 'conditional-exports-optout' | ||
import v1 from 'conditional-exports-optout/subpath' | ||
|
||
import Client from './client' | ||
|
||
export default function Page() { | ||
return ( | ||
<div> | ||
{`Server: ${v}`} | ||
<br /> | ||
{`Server subpath: ${v1}`} | ||
<br /> | ||
<Client /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/e2e/app-dir/rsc-basic/node_modules_bak/conditional-exports-optout/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'index.default' |
1 change: 1 addition & 0 deletions
1
test/e2e/app-dir/rsc-basic/node_modules_bak/conditional-exports-optout/index.server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'index.react-server' |
15 changes: 15 additions & 0 deletions
15
test/e2e/app-dir/rsc-basic/node_modules_bak/conditional-exports-optout/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "conditional-exports-optout", | ||
"main": "index.js", | ||
"exports": { | ||
".": { | ||
"react-server": "./index.server.js", | ||
"default": "./index.js" | ||
}, | ||
"./subpath": { | ||
"react-server": "./subpath.server.js", | ||
"default": "./subpath.js" | ||
}, | ||
"./package.json": "./package.json" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
test/e2e/app-dir/rsc-basic/node_modules_bak/conditional-exports-optout/subpath.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'subpath.default' |
1 change: 1 addition & 0 deletions
1
test/e2e/app-dir/rsc-basic/node_modules_bak/conditional-exports-optout/subpath.server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'subpath.react-server' |