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

Update postcss-load-config to 4.x and address synchronisation issues (*breaking change*) #596

Merged
merged 4 commits into from
Sep 3, 2022

Conversation

stefanvermaas
Copy link
Contributor

@stefanvermaas stefanvermaas commented Jul 16, 2022

This is a 🐛 bug fix (?)

Summary

As reported in #591, postcss-load-config introduced a breaking change in their latest major version update: 4.x. Instead of loading the configuration in a synchronous way, it's needed to load the configuration in an asynchronous way.

The PR;

  • Allows loading the PostCSS configuration under postcss-load-config > 4.x again.
  • Updates the postcss-load-config references from 3.1.4 to 4.0.1.
  • Updates the template for the lit/esbuild-plugins to also use the asynchronous API.
  • Updates the naming of the "import" function of the PostCSS plugin to align it with the other "import" functions in the esbuild.defaults.js.

I'm a bit rusty on my JavaScript, so I'm looking for feedback on the proposed async/await changes. I'm also not sure how I could add a test case for this and whether or not I should add a test case for this fix.

I also wonder whether or not you'd want to support both 3.x and 4.x versions of the postcss-load-config package as I'd need to provide a way to use both versions to get the configuration object.

I tested out things locally with the latest version of postcss-load-config and was able to build the Bridgetown site again with the new configuration.

Context

Fixes #591

@jaredcwhite
Copy link
Member

Thanks for the PR @stefanvermaas! Apologies for the delay in looking into this. I'll try to review soon.

@jaredcwhite jaredcwhite added the process Improve the development process for the repo label Sep 3, 2022
@jaredcwhite jaredcwhite added this to the 1.2 milestone Sep 3, 2022
@jaredcwhite jaredcwhite changed the title Update postcss-load-config to 4.x and address synchronisation issues. Update postcss-load-config to 4.x and address synchronisation issues (*breaking change*) Sep 3, 2022
@jaredcwhite
Copy link
Member

Thanks for your patience @stefanvermaas. Looking good to me! We'll want to make sure we mark this a breaking change as the build function call in esbuild.config.js will now return immediately with a promise, rather than run synchronously. If folks have added extra code to run after the build function, they'll have to use .then:

build(outputFolder, esbuildOptions).then(() => {
  console.log("build complete")
})

@jaredcwhite jaredcwhite merged commit 06f6cdc into bridgetownrb:main Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
process Improve the development process for the repo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support postcss-load-config >= 4.x
2 participants