Skip to content

Commit

Permalink
add next.config.js validation to turbopack
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsakenHarmony committed Dec 22, 2022
1 parent d02484d commit 586f141
Show file tree
Hide file tree
Showing 5 changed files with 541 additions and 33 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/next-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ bench = false
[dependencies]
anyhow = "1.0.47"
auto-hash-map = { path = "../auto-hash-map" }
crossterm = "0.25"
indexmap = { workspace = true, features = ["serde"] }
indoc = "1.0"
mime = "0.3.16"
num_cpus = "1.13.1"
once_cell = "1.13.0"
qstring = "0.7.2"
serde = "1.0.136"
Expand Down
10 changes: 9 additions & 1 deletion crates/next-core/js/src/entry/config/next.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@ import { PHASE_DEVELOPMENT_SERVER } from "next/dist/shared/lib/constants";

const loadNextConfig = async () => {
const nextConfig = await loadConfig(PHASE_DEVELOPMENT_SERVER, process.cwd());
nextConfig.rewrites = await nextConfig.rewrites?.();

nextConfig.generateBuildId = await nextConfig.generateBuildId?.();
nextConfig.headers = await nextConfig.headers?.();
nextConfig.redirects = await nextConfig.redirects?.();
nextConfig.rewrites = await nextConfig.rewrites?.();

// TODO: these functions takes arguments, have to be supported in a different way
nextConfig.exportPathMap = nextConfig.exportPathMap && {};
nextConfig.webpack = nextConfig.webpack && {};

return nextConfig;
};

Expand Down
Loading

0 comments on commit 586f141

Please sign in to comment.