Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/next-api/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,9 @@ impl Project {
let node_execution_chunking_context = Vc::upcast(
NodeJsChunkingContext::builder(
self.project_root_path().owned().await?,
node_root.clone(),
node_root.join("build")?,
self.node_root_to_root_path().owned().await?,
node_root.clone(),
node_root.join("build")?,
node_root.join("build/chunks")?,
node_root.join("build/assets")?,
node_build_environment().to_resolved().await?,
Expand Down
8 changes: 6 additions & 2 deletions packages/next/src/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2818,6 +2818,10 @@ export default async function build(
)
)

const sortedStaticPaths = Array.from(staticPaths.entries()).sort(
([a], [b]) => a.localeCompare(b)
)

const exportApp = (require('../export') as typeof import('../export'))
.default as typeof import('../export').default

Expand Down Expand Up @@ -2885,7 +2889,7 @@ export default async function build(

// TODO: output manifest specific to app paths and their
// revalidate periods and dynamicParams settings
staticPaths.forEach((routes, originalAppPath) => {
sortedStaticPaths.forEach(([originalAppPath, routes]) => {
const appConfig = appDefaultConfigs.get(originalAppPath)
const isDynamicError = appConfig?.dynamic === 'error'

Expand Down Expand Up @@ -3054,7 +3058,7 @@ export default async function build(
await fs.unlink(serverBundle)
}

staticPaths.forEach((prerenderedRoutes, originalAppPath) => {
sortedStaticPaths.forEach(([originalAppPath, prerenderedRoutes]) => {
const page = appNormalizedPaths.get(originalAppPath)
if (!page) throw new InvariantError('Page not found')

Expand Down
8 changes: 1 addition & 7 deletions packages/next/src/build/turbopack-build/impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,7 @@ export async function turbopackBuild(): Promise<{
})
await fs.writeFile(
path.join(distDir, 'package.json'),
JSON.stringify(
{
type: 'commonjs',
},
null,
2
)
Comment on lines -107 to -113
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would this not be deterministic?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package.json is written in multiple places. Most of them write {"type": "commonjs"} except here, where it writes a prettier JSON.

After these change all write the same content...

Maybe we should avoid writing it multiple times, but that's other problem...

'{"type": "commonjs"}'
)

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
Loading