Closed as not planned
Description
What version of Remix are you using?
1.11
Steps to Reproduce
This is how I discovered this issue:
- run
npx create-remix@latest. "Just the Basics," "Remix App Server," "Typescript, and "yes" to runnpm install. - Open the project
- Run
npm run devand take a look at what it generated. It should work just fine. - Ctrl+C to stop it. Run
npm install @azure/msal-nodein the console. I used version 1.14.6. - in
app/models, create a file calledmicrosoftClientApp.tsand paste the following:
import { PublicClientApplication } from "@azure/msal-node";
export let clientApp = new PublicClientApplication({
auth: {
clientId: process.env.CLIENT_ID || "",
authority: ""
}
})- in
app/routes/index.ts, create a loader as follows:
export let loader: LoaderFunction = async ({ request }) => {
const authRequest: AuthorizationCodeRequest = {
scopes: [
"User.Read",
"Calendars.Read",
"Calendars.Read.Shared",
"Calendars.ReadWrite",
"Calendars.ReadWrite.Shared",
],
redirectUri: process.env.REDIRECT_URI || "",
code: "",
};
const microsoftAuthURL = await clientApp.getAuthCodeUrl(authRequest);
return json(authRequest);
// return json({ url: microsoftAuthURL });
};and paste the following at the top of the Index function:
const data = useLoaderData<typeof loader>();- Change something about the existing JSX. It doesn't matter what you change (I just added some
<p>tags with random text at the top), just add something that wasn't there before. - run
npm run devin the console. It should run just fine, and for some reason, you'll see that it generates what it generated before. That is, it won't have the changes you made to it. - Ctrl+C to stop it. Now run
npm run build. You should see some error about polyfills and HTTP. This error is not the point. The point is, runningnpm run devshould have shown you this error and not have just generated the last page it had generated.
If you comment out the loader function and all that, you'll see that all of a sudden, running npm run dev generates the changes you made in Index.
Expected Behavior
What should happen is everything that happened above, except instead of just loading the previously-generated page, it should show you the error that came in build and just not generate the page at all. Bugs should be shown clearly to the developer while running the app in development mode.
Actual Behavior
It didn't show me the error that came up while building, and instead just loaded the previously-generated page (the page that existed before you added the changes to Index).
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]Bugs in code don't erro in development[/-][+]Bugs in code don't error in development[/+]machour commentedon Jan 21, 2023
There's already a proposal to have this feature: #4196
Please upvote it so it gets picked in the roadmap weekly meeting 🙏
kiliman commentedon Jan 24, 2023
I have a sample app with a patch that adds support for this.
https://github.com/kiliman/remix-build-error