-
Notifications
You must be signed in to change notification settings - Fork 65
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
Type checking in the build process #52
base: main
Are you sure you want to change the base?
Type checking in the build process #52
Conversation
"build": "vite build", | ||
"build:ssr": "vite build && vite build --ssr", | ||
"build:ssr": "npm run build && vite build --ssr", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the difference running npm run build && vite build --ssr
vs vite build && vite build --ssr
LMK. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you execute npm run build
, npm run prebuild
is automatically executed before the build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, perfect. Thanks for letting me know.
Hey @christophstockinger. Thanks for the PR. So, if we add this as an NPM build step, why aren't you adding this to the CI workflow? Seems like if we are going to add it in, we might as well add it to the workflow file, right? |
More information you find here: https://docs.npmjs.com/cli/v8/using-npm/scripts |
resources/js/types/vite.d.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any particular reason these declarations were included instead of the usual vite-env.d.ts
like the original Breeze templates had? Something along the lines of:
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_APP_NAME: string;
[key: string]: string | boolean | undefined;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
readonly glob: <T>(pattern: string) => Record<string, () => Promise<T>>;
}
within a resources/js/types/vite-env.d.ts
file. I think this approach completely overrides anything declared in ImportMetaEnv
and ImportMeta
if it exists in vite/client
, rather than merging it (like the above). I know this PR is just moving this bit to a separate file, so it might be a better question for @tnylea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoeyMckenzie I have just tried it out. You are right, the type declaration for vite/client
is not needed. I have just adjusted the PR accordingly and removed it.
Thanks, Christoph 👏 Will be doing some discussion with Taylor on this tomorrow, and we'll follow up. Appreciate it! |
ℹ️ Port of the react-starter-kit laravel/react-starter-kit#37
This pull request adds a tsc (TypeScript Compiler) task to the build process. Currently, the build pipeline does not include a TypeScript type-checking step, which means that potentially erroneous TypeScript code could be deployed to production without being caught during the build process.
By incorporating the tsc task, we ensure that type errors are detected early in the build cycle, preventing invalid or mis-typed code from being pushed to production. This enhances the overall stability and reliability of the codebase and reduces the risk of runtime errors caused by type mismatches. Type checking during the build process also helps maintain consistency in our code, making it easier to spot bugs early on and ensuring a higher level of confidence in the production deployment.
Benefits:
Please review and provide feedback. Thank you!