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

feat: add devTarget option (fixes #141) #149

Merged
merged 1 commit into from
Sep 21, 2023
Merged

feat: add devTarget option (fixes #141) #149

merged 1 commit into from
Sep 21, 2023

Conversation

ArnaudBarre
Copy link
Member

@ArnaudBarre ArnaudBarre commented Sep 17, 2023

Fixes #141

The current implicit devTarget of Vite is esbuild.target, but this is disable by the plugin.

I was thinking of adding server.target to Vite core, but I'm not sure the added field will be more clear for users (given that we already ignore tsConfig targets)

@ArnaudBarre ArnaudBarre self-assigned this Sep 17, 2023
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

Even if we introduced server.target in Vite core, I guess it'd be difficult to covert esbuild target to SWC target.

@bluwy
Copy link
Member

bluwy commented Sep 18, 2023

I think we can probably swallow some maintenance on converting esbuild-style targets to these (like lightningcss too). But if we ever did that, I think it's worth cleaning up targets we read, like from tsconfig#target, esbuild.target, esbuildOptions.target, css.lightningcss.targets and build.cssTarget. And only make two ways to configure it - server.target and build.target 🤔

@ArnaudBarre
Copy link
Member Author

CSS targets is a useful additions for people targeting non mainstream browser apparently: https://vitejs.dev/config/build-options.html#build-csstarget

I don't think we read tsconfig#target currently, expect for matching esbuild behaviour for enabling other flags.

esbuild target system is not perfect so I think we should keep lightningcss.targets, it doesn't cost that much.

The only issue IMO is the fact that we you want to change the dev target, you need to change esbuildOptions.target and esbuild.target which is not intuitive but at least it's possible and it works

@bluwy
Copy link
Member

bluwy commented Sep 18, 2023

The only issue IMO is the fact that we you want to change the dev target, you need to change esbuildOptions.target and esbuild.target which is not intuitive but at least it's possible and it works

That's because in most cases, the default dev target should work in most evergreen browsers without needing changing. So if you really need to, you'd reach out to those specific options.

If we were to add another new option, I think we should re-think our target approach further to make it simpler and opinionated. There's already a lot of places to configure target, which each makes sense, but not the most user-friendly thing to configure.

@ArnaudBarre ArnaudBarre merged commit bc2bf2f into main Sep 21, 2023
1 check passed
@ArnaudBarre ArnaudBarre deleted the devTarget branch September 24, 2023 18:44
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.

Feature request: configure swc's target property
3 participants