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

Don't minify during development #593

Merged

Conversation

DavisVaughan
Copy link
Collaborator

Working in apps/vscode/ currently kind of sucks because the debugging experience is suboptimal. Sourcemaps don't seem to be working right, causing the Debug Variables pane to show minified names, not real names. Stepping is also pretty jumpy.

Turns out that we are minifying during our dev builds, which seems to be what is breaking things. It is also kind of weird right? We should only minify during production, not during development. That's also what VS Code's extension guide suggests:
https://code.visualstudio.com/api/working-with-extensions/bundling-extension#run-esbuild

And what esbuild's guide says: "Usually you minify code in production but not in development."
https://esbuild.github.io/api/#minify

Before:

(Note how the variables pane has 1 letter names, and how it jumps over the if branch, seemingly without running it)

Screen.Recording.2024-10-30.at.12.00.24.PM.mov

After:

fixed.mov

In theory both VS Code and esbuild have all the required glue to make minify + sourcemaps work through this names mapping field, but clearly something isn't working right:
evanw/esbuild#1296
microsoft/vscode#12066

Copy link
Contributor

@cscheid cscheid left a comment

Choose a reason for hiding this comment

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

Do we want to split the difference and keep the minify option, but defer to dev if minify is undefined? I'm not sure I want to remove minify before understanding exactly how it could be used.

packages/build/src/index.ts Outdated Show resolved Hide resolved
@DavisVaughan
Copy link
Collaborator Author

DavisVaughan commented Nov 1, 2024

I've kept the exposed minify option and instead just set it to minify: !dev, in the two places that we call runBuild() - which makes this an even more minimal fix

@DavisVaughan DavisVaughan merged commit b6a1ef4 into quarto-dev:main Nov 1, 2024
1 check passed
@DavisVaughan DavisVaughan deleted the fix/dont-minify-during-dev branch November 1, 2024 14:52
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.

2 participants