Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat user code as a referenced project #2444

Merged
merged 8 commits into from
Jan 21, 2025
Merged

Conversation

sodic
Copy link
Contributor

@sodic sodic commented Jan 10, 2025

Fixes #2247

@sodic sodic force-pushed the filip-project-references branch from 3fd1830 to 4d3f95d Compare January 17, 2025 09:22
@@ -36,5 +20,8 @@
},
"include": [
"src"
],
"references": [
{ "path": "../../../tsconfig.json" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Todo: draw this knowledge from Haskell.

Same thing in package.json.

],
"references": [
// TODO: It would be better to inject this knowledge from Haskell.
{ "path": "../../../tsconfig.json" }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Todo: draw this knowledge from Haskell, make it work with Wasp TS config.

Currently fails when using Wasp TS Config with this error:
image

It's not noticeable in the server because we don't run tsc - everything is bundled so project references don't yet make a difference.

The client unfortunately breaks.

@@ -6,6 +6,9 @@
{
"compilerOptions": {
"module": "esnext",
// Needed because this is used as a project reference.
// TODO: Why doesn't next need it
"composite": true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Todo: explore why doesn't next need this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Todo: document where you got this from (Vite).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Todo: explain where you got this from (Vite and other research)

// https://stackoverflow.com/questions/42609768/typescript-error-cannot-write-file-because-it-would-overwrite-input-file
"outDir": ".wasp/phantom"
}
"outDir": ".wasp/out/user"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Todo: leave comment why not noEmit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Explain where you got this (Vite)

// make project references work for the TS config), then I believe the
// correct configuration is "rootDir": "." (the project reference should
// take care of the user code), but we should double-check.
"rootDir": ".",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Link to previous history.

"vite.config.ts",
"./src/ext-src/vite.config.ts"
]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Newline

@@ -1,11 +1,18 @@
// =============================== IMPORTANT =================================
Copy link
Contributor

Choose a reason for hiding this comment

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

Idea for the future, I've love it if we could apply tsconfig fixes with Wasp CLI so users don't have to do it manually.

@@ -20,6 +27,7 @@
"dom.iterable",
"esnext"
],
"skipLibCheck": true,
Copy link
Contributor

Choose a reason for hiding this comment

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

We added this option, but we validate it with anyValueIsFine so why add it at all?

@sodic sodic marked this pull request as ready for review January 21, 2025 22:16
@@ -62,6 +64,9 @@ validateSrcTsConfig tsConfig =
showAsJsValue expectedValue ++ "."
]

anyValueIsFine :: FullyQualifiedFieldName -> [String]
anyValueIsFine = const []
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Todo: remove

@sodic sodic merged commit 51f1e90 into main Jan 21, 2025
1 of 6 checks passed
@sodic sodic deleted the filip-project-references branch January 21, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Always use the user's tsconfig.json when processing their code
2 participants