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

Add browserslist constraint #2788

Closed
madbrain opened this issue May 16, 2019 · 6 comments
Closed

Add browserslist constraint #2788

madbrain opened this issue May 16, 2019 · 6 comments

Comments

@madbrain
Copy link

Adding browserslist constraint would greatly help integration by tools such as Parcel.
The use of ES6 classes in version 3.x without further informations in package.json actually prevent Parcel from correctly handling module transpilation (DeMoorJasper/parcel-plugin-svelte#44).

Browserslist configuration is kind of obscure to me, but the following constraint seems to work fine :

"browserslist": [ "edge >= 13" ]
@varholak-peter
Copy link
Contributor

May help a bit with #558

@madbrain
Copy link
Author

Thanks @varholak-peter, the browserslist settings from your PR works great with Parcel now.

@maxmilton
Copy link
Contributor

I'm not sure what you're suggesting here. Configuring browserslist is something that should be done at a per-app level, not really inside packages. The only compatibility transpiling which Svelte does is via TypeScript, which as far as I'm aware, does not take browserslist into account.

@varholak-peter
Copy link
Contributor

For me, browserlist is more of a "can I use this for my project that requires me to support these browsers" kind of thing, when proposing the library.

@0gust1
Copy link

0gust1 commented May 19, 2019

It's not an easy question :
browserlist covers a wide range of things depending on the tool (PostCSS, babel, etc.) which use it :

  • JS language features (ES features, like classes, generators, async/await, etc.)
  • but also DOM API features (intersection observer, fetch, resource hints, etc.)
  • and also CSS features (grid layout, position:sticky, etc.)

Putting a browserlist in the project will send a false signal to users. Svelte is only a lib, not an application. The consumer / implementer will have to decide what level of support he wants, according to its constraints/userbase and adjust its build process and polyfills implementation.

Browserlist is originally a tool for an app project, to centralize the place where we express the range of browsers the app have to support.

As @maxmilton said :

Configuring browserslist is something that should be done at a per-app level, not really inside packages.

@madbrain
Copy link
Author

Thanks @0gust1 for the clear explanation on where to use browserslist or not.
I may have been fooled by Parcel which uses available information (browserslist, babelrc) in dependencies (and so libraries) to decide the level of transpilation to apply to reach the target level.
This should be used as an hint and not be a rule.

Further investigations (well... a few hours of debugging 😞) seem to show that the problem is actually coming from Parcel itself. Sorry @varholak-peter for the noise, hope your PR is not useless.

By the way, as svelte is mostly used as node module, package.json should contains:

"engines": { "node": ">= 6.0.0" }

as class feature is only available starting from version 6 (yes I'm getting picking nobody uses such old versions 😉 ).

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 a pull request may close this issue.

4 participants