Skip to content

Commit

Permalink
Add project reference to user code from server
Browse files Browse the repository at this point in the history
  • Loading branch information
sodic committed Jan 10, 2025
1 parent 382dc59 commit 79924a0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
5 changes: 4 additions & 1 deletion waspc/data/Cli/templates/skeleton/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
// it to prevent this error:
// https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file
"outDir": ".wasp/out/user"
}
},
"include": [
"src"
]
}
1 change: 1 addition & 0 deletions waspc/data/Generator/templates/react-app/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"src"
],
"references": [
// TODO: It would be better to inject this knowledge from Haskell.
{ "path": "../../../tsconfig.json" }
]
}
9 changes: 6 additions & 3 deletions waspc/data/Generator/templates/react-app/tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"noEmit": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"noEmit": true
},
"include": ["vite.config.ts", "./src/ext-src/vite.config.ts"]
}
"include": [
"vite.config.ts",
"./src/ext-src/vite.config.ts"
]
}
21 changes: 4 additions & 17 deletions waspc/data/Generator/templates/server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,7 @@
"compilerOptions": {
// Overriding this until we implement more complete TypeScript support.
"strict": false,
// When left unspecified, the 'rootDir' defaults to the longest common path of
// all non-declaration input files. TypeScript mimics the source structure
// inside the output directory (i.e., 'dist').
//
// Since Wasp apps can (but don't have to) import user files from
// '../../../src', it makes the rootDir's default value inconsistent:
// - When the app doesn't import user files (e.g., the user didn't specify
// any operations), the rootDir is set to the server source dir (/src).
// - When the app imports user files (as is the case for most Wasp apps),
// the rootDir is set to the Wasp project root (../../../).
//
// Our build script (in package.json) requires a consistent structure of
// the output directory, which is why we always make sure to point the rootDir
// to the Wasp project root (../../../).
//
// See this comment for more details: https://github.com/wasp-lang/wasp/pull/1584#discussion_r1404019301
"rootDir": "../../../",
"rootDir": ".",
// Overriding this because we want to use top-level await
"module": "esnext",
"target": "es2017",
Expand All @@ -36,5 +20,8 @@
},
"include": [
"src"
],
"references": [
{ "path": "../../../tsconfig.json" }
]
}

0 comments on commit 79924a0

Please sign in to comment.