-
Notifications
You must be signed in to change notification settings - Fork 1
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
CSS bundling interop #1
Comments
Thanks for making these tests! Looks valuable. I'll take a more detailed look soon. |
Thanks for putting these together. Test cases are a great way to promote interop. I took a brief look at these. It looks like you're primarily asking for esbuild to implement bundling of conditional imports. This is not a bug with esbuild. It's just not feature that esbuild currently implements, which should already be indicated by the error message that esbuild generates when you attempt to do this. See: evanw/esbuild#953. I'm also seeing errors of the form Regarding the test suite: I could not get it to work. I don't use puppeteer myself, and I'm not going to look into fixing this. Running the suggested command didn't work (note that I'm running this in GitHub Codespaces). The error looks like this:
I was able to run your tests by commenting out the Firefox stuff and renaming Edit: For my own reference, the additional commands required to get this to run are:
After a while the script prints out a markdown table and hangs. Then you have to manually exit the script. |
Thank you for that! I've changed the settings and many of those tests now pass.
I am not asking for any fixes or feature additions here :) However I think it's valuable to have a shared test suite to verify that supported features work consistently in multiple tools.
I don't think it is important to compare these tools publicly. It is easy to create a negative spiral and I am not interested in that.
Puppeteer makes it possible but not easy to setup and test against Firefox. The setup command here is The current test suite is something that worked for me when trying to fix bugs in If there is interest to share a test suite between multiple tools then I think we first need to align on what that would look like.
Our projects all have different setups, constraints, ... |
Correct, |
I reformatted these tests as a single HTML page to make them easy to run: https://github.com/evanw/css-import-tests. You can now just open the page in a web browser to run the tests (and in theory just swap the CSS entry point file with a bundled one to test the output from a specific bundler). Some additional things I noticed:
After looking at these in detail, I'm not sure what to think about the tests that require the files to be served by a web server at a certain location. Specifically:
I'm not sure it makes sense for a CSS bundler to support these cases. At least, I'm not planning on supporting these with esbuild. It would be convenient for me to have the test suite for CSS features be separate from the test suite that tests browser emulation. That way you could reasonably expect a CSS bundler to eventually pass all of the CSS feature tests, and the browser emulation tests could be informational only without any expectation of CSS bundlers actually passing them. Edit: I added another HTML page to that repo with the subset of tests that I would expect a CSS bundler to pass. |
Thank you @evanw for taking an in-depth look. I think failures fall in roughly these categories :
I think there is value in charting all cases. Tests under tests must not have :
Tests should be grouped so that implementers can pick the test suites that are relevant for them.
For 99% of cases the second option will just work. This is what I think it makes sense to align on these cases between tools.
Maybe someone finds something clever to implement one of these after all. The nuance between This would roughly look like this :
Interactions between multiple sub features are problematic. Is this a separate group? Or is there a pre-defined order in which features are assumed to be implemented. e.g. if you support supports conditions then you also support media conditions, so interactions can be tested in the supports conditions group. I don't really want to discuss individual cases in this thread, because it's easy to get side tracked. But happy to discuss any of them in separate issues :)
Yes, I filed a bug report : https://bugzilla.mozilla.org/show_bug.cgi?id=1844683 |
The latest version of esbuild (v0.18.20) implements conditional imports. I believe this means esbuild should now pass all tests regarding CSS features except for The test |
That is good to hear :) Nice that these tests are useful. Do you have any feedback or insights on how we can make these tests useful going forward? |
Hi @evanw @devongovett,
While working on some fixes for
postcss-import
I wanted to compare the behavior of that bundler with how browsers natively handle@import
.I also wanted to compare with other CSS bundlers (both esbuild and lightningcss can bundle CSS).
Not to compete with either but because I value interop.
I strongly believe that multiple tools that bundle CSS should do so in similar and predictable ways.
Users should not have to refactor their source code when switching between PostCSS, esbuild, lightningcss, ...
This repository contains a bunch of tests that all pass in either Firefox or Chrome.
(Firefox crashes on some cyclical imports, Chrome doesn't support
supports()
conditions in imports.)Since I personally do not use esbuild or lightningcss I am not going to invest time to file bugs for each test failure.
I do however think it would be valuable to have a shared test suite.
Think "WPT" but for CSS bundlers.
A shared set of tests that multiple parties agree on and that each can use to verify their own project.
The intention is not to enforce a passing grade or to blame anyone in case of a test failure.
Each tool is obviously free to choose a "non-standard" direction if that makes more sense to them.
Main benefits from my point of view :
Is this something you want to collaborate on?
The text was updated successfully, but these errors were encountered: