Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
bf484488
Commit
bf484488
authored
Sep 06, 2024
by
Jiachi Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable experimental.optimizeServer by default (#69788)
parent
86547db9
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
146 additions
and
1 deletion
+146
-1
config-shared.ts
packages/next/src/server/config-shared.ts
+1
-1
utils.ts
...production/app-dir/actions-tree-shaking/_testing/utils.ts
+1
-0
tsconfig.json
.../actions-tree-shaking/shared-module-actions/tsconfig.json
+24
-0
layout.js
...dir/actions-tree-shaking/use-effect-actions/app/layout.js
+7
-0
actions.ts
...ions-tree-shaking/use-effect-actions/app/mixed/actions.ts
+11
-0
my-component.tsx
...ree-shaking/use-effect-actions/app/mixed/my-component.tsx
+9
-0
page.tsx
...ctions-tree-shaking/use-effect-actions/app/mixed/page.tsx
+23
-0
tsconfig.json
...dir/actions-tree-shaking/use-effect-actions/tsconfig.json
+24
-0
use-effect-actions-edge.test.ts
...haking/use-effect-actions/use-effect-actions-edge.test.ts
+3
-0
use-effect-actions.test.ts
...ree-shaking/use-effect-actions/use-effect-actions.test.ts
+25
-0
turbopack-build-tests-manifest.json
test/turbopack-build-tests-manifest.json
+18
-0
No files found.
packages/next/src/server/config-shared.ts
View file @
bf484488
...
@@ -939,7 +939,7 @@ export const defaultConfig: NextConfig = {
...
@@ -939,7 +939,7 @@ export const defaultConfig: NextConfig = {
:
false
,
:
false
,
webpackBuildWorker
:
undefined
,
webpackBuildWorker
:
undefined
,
missingSuspenseWithCSRBailout
:
true
,
missingSuspenseWithCSRBailout
:
true
,
optimizeServerReact
:
tru
e
,
optimizeServerReact
:
fals
e
,
useEarlyImport
:
false
,
useEarlyImport
:
false
,
staleTimes
:
{
staleTimes
:
{
dynamic
:
30
,
dynamic
:
30
,
...
...
test/production/app-dir/actions-tree-shaking/_testing/utils.ts
View file @
bf484488
// @ts-ignore avoid ts errors during manual testing
import
{
type
NextInstance
}
from
'e2e-utils'
import
{
type
NextInstance
}
from
'e2e-utils'
async
function
getActionsMappingByRuntime
(
async
function
getActionsMappingByRuntime
(
...
...
test/production/app-dir/actions-tree-shaking/shared-module-actions/tsconfig.json
0 → 100644
View file @
bf484488
{
"compilerOptions"
:
{
"target"
:
"ES2017"
,
"lib"
:
[
"dom"
,
"dom.iterable"
,
"esnext"
],
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
false
,
"noEmit"
:
true
,
"incremental"
:
true
,
"module"
:
"esnext"
,
"esModuleInterop"
:
true
,
"moduleResolution"
:
"node"
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
,
"jsx"
:
"preserve"
,
"plugins"
:
[
{
"name"
:
"next"
}
]
},
"include"
:
[
"next-env.d.ts"
,
".next/types/**/*.ts"
,
"**/*.ts"
,
"**/*.tsx"
],
"exclude"
:
[
"node_modules"
]
}
test/production/app-dir/actions-tree-shaking/use-effect-actions/app/layout.js
0 → 100644
View file @
bf484488
export
default
function
Layout
({
children
})
{
return
(
<
html
>
<
body
>
{
children
}
<
/body
>
<
/html
>
)
}
test/production/app-dir/actions-tree-shaking/use-effect-actions/app/mixed/actions.ts
0 → 100644
View file @
bf484488
'use server'
export
async
function
action1
()
{
return
{
hello
:
'world'
}
}
export
async
function
action2
()
{
return
{
hello
:
'action2'
}
}
export
async
function
action3
()
{
return
{
hello
:
'action3'
}
}
test/production/app-dir/actions-tree-shaking/use-effect-actions/app/mixed/my-component.tsx
0 → 100644
View file @
bf484488
import
{
action3
}
from
'./actions'
export
default
function
MyComponent
()
{
// to prevent tree-shaking
if
(
globalThis
.
DO_NOT_TREE_SHAKE
)
{
console
.
log
(
'MyComponent imported action3'
,
action3
)
}
return
<
span
>
i'm MyComponent
</
span
>
}
test/production/app-dir/actions-tree-shaking/use-effect-actions/app/mixed/page.tsx
0 → 100644
View file @
bf484488
'use client'
import
React
,
{
useEffect
}
from
'react'
import
{
action1
,
action2
}
from
'./actions'
import
MyComponent
from
'./my-component'
export
default
function
Page
()
{
// to prevent tree-shaking
if
(
globalThis
.
DO_NOT_TREE_SHAKE
)
{
console
.
log
(
'Page imported action2'
,
action2
)
}
// calling action1 fails!!
useEffect
(()
=>
{
if
(
globalThis
.
DO_NOT_TREE_SHAKE
)
{
action1
().
then
((
obj
)
=>
{
console
.
log
(
'action1 returned:'
,
obj
)
})
}
},
[])
return
<
MyComponent
/>
}
test/production/app-dir/actions-tree-shaking/use-effect-actions/tsconfig.json
0 → 100644
View file @
bf484488
{
"compilerOptions"
:
{
"target"
:
"ES2017"
,
"lib"
:
[
"dom"
,
"dom.iterable"
,
"esnext"
],
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
false
,
"noEmit"
:
true
,
"incremental"
:
true
,
"module"
:
"esnext"
,
"esModuleInterop"
:
true
,
"moduleResolution"
:
"node"
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
,
"jsx"
:
"preserve"
,
"plugins"
:
[
{
"name"
:
"next"
}
]
},
"include"
:
[
"next-env.d.ts"
,
".next/types/**/*.ts"
,
"**/*.ts"
,
"**/*.tsx"
],
"exclude"
:
[
"node_modules"
]
}
test/production/app-dir/actions-tree-shaking/use-effect-actions/use-effect-actions-edge.test.ts
0 → 100644
View file @
bf484488
process
.
env
.
TEST_EDGE
=
'1'
require
(
'./use-effect-actions.test'
)
test/production/app-dir/actions-tree-shaking/use-effect-actions/use-effect-actions.test.ts
0 → 100644
View file @
bf484488
import
{
nextTestSetup
}
from
'e2e-utils'
import
{
getActionsRoutesStateByRuntime
,
markLayoutAsEdge
,
}
from
'../_testing/utils'
describe
(
'actions-tree-shaking - use-effect-actions'
,
()
=>
{
const
{
next
}
=
nextTestSetup
({
files
:
__dirname
,
})
if
(
process
.
env
.
TEST_EDGE
)
{
markLayoutAsEdge
(
next
)
}
it
(
'should not tree shake the used action under useEffect'
,
async
()
=>
{
const
actionsRoutesState
=
await
getActionsRoutesStateByRuntime
(
next
)
expect
(
actionsRoutesState
).
toMatchObject
({
'app/mixed/page'
:
{
'action-browser'
:
3
,
},
})
})
})
test/turbopack-build-tests-manifest.json
View file @
bf484488
...
@@ -15600,6 +15600,24 @@
...
@@ -15600,6 +15600,24 @@
"pending"
:
[],
"pending"
:
[],
"flakey"
:
[],
"flakey"
:
[],
"runtimeError"
:
false
"runtimeError"
:
false
},
"test/production/app-dir/actions-tree-shaking/use-effect-actions/use-effect-actions-edge.test.ts"
:
{
"passed"
:
[],
"failed"
:
[
"actions-tree-shaking - use-effect-actions should not tree shake the used action under useEffect"
],
"pending"
:
[],
"flakey"
:
[],
"runtimeError"
:
false
},
"test/production/app-dir/actions-tree-shaking/use-effect-actions/use-effect-actions.test.ts"
:
{
"passed"
:
[],
"failed"
:
[
"actions-tree-shaking - use-effect-actions should not tree shake the used action under useEffect"
],
"pending"
:
[],
"flakey"
:
[],
"runtimeError"
:
false
}
}
},
},
"rules"
:
{
"rules"
:
{
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment