-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix(preset-env): Consider browserslist config if env.target not configured #8921
base: main
Are you sure you want to change the base?
fix(preset-env): Consider browserslist config if env.target not configured #8921
Conversation
Defaults to empty PathBuf for wasm32 target, but does not seem to be used anyway
|
|
Maybe reconsider this later if this is functionality we want
25eb315
to
7a7aaf8
Compare
cc @kwonoj |
It seems some of the tests fail due to them expecting a specific prerecorded results, but this result has now changed due to the previous default without a target being Seems forcing a browserslist query when target is none is not the best approach. I won't try any fixes before hearing your feedback on how to handle this. Should we make the |
Description:
The
env.path
option in.swcrc
was originally implemented forbrowserslist
, but implementation was (unintentionally?) removed during the migration tobrowserslist-rs
(#2845).Searching the current directory for browserslist configuration was also dropped in the process.
This PR reimplements searching for browserslist configuration using the lookup functionality provided by
browserslist-rs
BREAKING CHANGE:
This may be considered a breaking change since the previous (broken) behavior for unconfigured
env.targets
was to return aBrowserData
struct with allOption
s set toNone
. Now the result of a browserslistdefaults
query is returned instead. This probably was the original behavior withbrowserslist
, though.Update: Thinking about it again,
targets_to_versions()
is part ofpreset_env_base
s public API so we should probably consider this a breaking change anyway.Things to consider:
browserslist-rs
does not provide configuration loading for wasm32 targets (which is probably to be expected that we won't check environment variables or search a filesystem in that case)feat(preset-env): Let browserslist-rs handle default config path
changes the default for an unconfiguredenv.path
from an empty string for wasm targets / current dir for other targets to aNone
value.browserslist-rs
already looks up the current dir ifpath
isNone
and it felt better to let it handle this case itselfThe commit which migrated from
browserslist
tobrowserslist-rs
mentioned fixing thedefault_path
, but does not mention what was broken and I also did not find any other usage of thepath
property. If the previous implementation was intentional, just ignore that last commit in the PR, the first two sufficiently address the bug.Related issue:
Fixes #3365
Implements #3085