Skip to content

Conversation

@lishaduck
Copy link
Contributor

@lishaduck lishaduck commented Oct 24, 2025

Overview

A few tiny cleanups I noticed could be made while perusing around the codebase.

Manual Testing

Bundle, check it still works.

Related Issue

This PR is stacked on #1945.

@netlify
Copy link

netlify bot commented Oct 24, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit cf3605b
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6901a765efdc900009234380
😎 Deploy Preview https://deploy-preview-1950--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@lishaduck lishaduck changed the base branch from main to major October 26, 2025 01:38
@aklinker1
Copy link
Member

Ugh, this diff is massive, did you rebase it correctly?

@lishaduck
Copy link
Contributor Author

Ugh, this diff is massive, did you rebase it correctly?

Haven't rebased it yet

@lishaduck lishaduck force-pushed the cleanup-esm branch 2 times, most recently from c603e7d to 8fab501 Compare October 27, 2025 22:36
Copy link
Member

@aklinker1 aklinker1 left a comment

Choose a reason for hiding this comment

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

We can also cleanup this file: https://github.com/wxt-dev/wxt/blob/main/packages/wxt/src/core/utils/eslint.ts

Other than the changes that make Vite a required dependency, the rest looks good.

Also, should this be based on the main branch? Or did you intend this to be a breaking change as well?

Copy link
Contributor Author

@lishaduck lishaduck left a comment

Choose a reason for hiding this comment

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

Oh, apparently I didn't hit submit on my review, sorry for leaving you without guidance.

I was a bit confused, like didn't I just clarify + ask you a followup question? Makes sense.

@lishaduck
Copy link
Contributor Author

lishaduck commented Oct 28, 2025

We can also cleanup this file: main/packages/wxt/src/core/utils/eslint.ts

Not sure what you mean, I did, right? eslint is an optional peerDependency, so it still needs the dynamic import.

Other than the changes that make Vite a required dependency, the rest looks good.

Vite is already a required dependency, is still a required dependency following #1945, and I'm skeptical of the multiple builders argument (I'll follow up on that above).
If you're referencing non-dynamic imports of Vite, those also already exist. I thought it might be intentional, but I decided it was just for CJS-compat because there are a few (two?) files that just directly (non-type) import 'vite'.

I'll revert the changes, but I'm pretty lost as to the reasoning.

Also, should this be based on the main branch? Or did you intend this to be a breaking change as well?

I didn't want to target changes that might be wrong, but having messed around with the codebase more, I'm pretty confident with them.

@aklinker1
Copy link
Member

aklinker1 commented Oct 28, 2025

The other imports to vite are because I got lazy... I'd prefer to keep it abstracted for now even if it's the only builder WXT supports. Maybe it's about time I clean those other imports up as well...

Undoing the builder abstraction or more tightly coupling Vite to the project is something I will stubbornly refuse to budge on right now, sorry.

@lishaduck
Copy link
Contributor Author

lishaduck commented Oct 29, 2025

The other imports to vite are because I got lazy... I'd prefer to keep it abstracted for now even if it's the only builder WXT supports. Maybe it's about time I clean those other imports up as well...

✅ It looked like more but they were just types. Could we turn on verbatimModuleSyntax now?

Undoing the builder abstraction or more tightly coupling Vite to the project is something I will stubbornly refuse to budge on right now, sorry.

No need to be sorry! I'm just curious why it's built this way, I was surprised because I thought WXT was all-in on Vite. Sorry if it comes off confrontational (and I'll try not to, but knowing me I'll probably manage to complain whenever I touch these files for all of eternity until I decide to add support for some shiny new bundler, please just ignore me)

@lishaduck lishaduck changed the base branch from major to main October 29, 2025 05:27
As far as I could tell, the original reasons are no longer reproducible.
Since wxt-dev#848, there's no need to do all this async work.
At least, as far as I could tell...
These seem harmless enough I'll leave them in ig
@lishaduck lishaduck requested a review from aklinker1 October 29, 2025 05:37
Comment on lines +580 to +581
const [resolvedInlineConfig = {}, resolvedUserConfig = {}] =
await Promise.all([inlineConfig.vite?.(env), userConfig.vite?.(env)]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could potentially be a race condition if someone is doing something stupid in their config file. Probably fine.

Comment on lines +112 to +115
const [vite, fromUser] = await Promise.all([
import('vite'),
userVite(env),
]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto

Comment on lines +29 to +32
const [builder, pm] = await Promise.all([
createViteBuilder(config, hooks, () => wxt.server),
createWxtPackageManager(config.root),
]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We own these, should be fine, but could potentially call something user created and cause a new race condition... yeah this is ridiculous.

const latestVersion = dep.info['dist-tags'].latest;
const latestVersionReleasedAt = new Date(dep.info.time[latestVersion]);

semver.RELEASE_TYPES;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

oxclint was complaining and I figured I'd be nice to it.
Not sure why check didn't notice it tho, a bit concerning (cause it's in the root prob?).

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