bridgetown icon indicating copy to clipboard operation
bridgetown copied to clipboard

Support `postcss-load-config` >= 4.x

Open stefanvermaas opened this issue 3 years ago • 3 comments

Version 4.x of postcss-load-config has a breaking change; it drops the sync() method upon which the default ESBuild configuration of Bridgetown relies.

See https://github.com/postcss/postcss-load-config/pull/234 for more information.

Bridgetown Version:

bridgetown 1.1.0.beta3 "Belmont"

To Reproduce

  1. Upgrade postcss-load-config to ^4.0.0 in package.json.
  2. Run yarn in the project.
  3. Run bin/bridgetown start
  4. Compilation fails due to error below
node esbuild.config.js --watch
[Frontend] /Users/stefan/code/org/project/config/esbuild.defaults.js:180
[Frontend] const postCssConfig = postcssrc.sync()
[Frontend]                                 ^
[Frontend]
[Frontend] TypeError: postcssrc.sync is not a function

Current behavior

Bridgetown fails to compile the CSS.

Expected behavior

Bridgetown compiles the CSS.

Screenshots

...

Computing environment (please complete the following information):

  • OS: MacOS

Additional context

I'd like to submit a PR for it and address it. However, I'm not 100% sure how the ESBuild configuration is set up and works for Bridgetown. Would need to dive a little bit deeper.

stefanvermaas avatar Jul 03 '22 12:07 stefanvermaas

@stefanvermaas Thanks for mentioning this. We'll definitely need to stay pinned to 3.x for the time being. IMHO that's a pretty ridiculous breaking change, but we've gotta play the hand we're dealt. I'm guessing we'll need to figure out some kind of async/await wrapper for the part of the script where it loads in the config…easier said than done because currently it's at the top level of the esbuild config script. I forget exactly which version of Node adds top-level async/await, but it's definitely higher than Bridgetown's minimum supported Node version at present.

jaredcwhite avatar Jul 03 '22 16:07 jaredcwhite

Thanks for mentioning this. We'll definitely need to stay pinned to 3.x for the time being.

Shall I proceed and create a PR for this? It might be the best solution for the short term.

MHO that's a pretty ridiculous breaking change, but we've gotta play the hand we're dealt.

Agreed.

I forget exactly which version of Node adds top-level async/await, but it's definitely higher than Bridgetown's minimum supported Node version at present.

I see. I'm not sure if it makes sense to already switch to a higher version if only one package needs it.

stefanvermaas avatar Jul 05 '22 08:07 stefanvermaas

@stefanvermaas

Shall I proceed and create a PR for this? It might be the best solution for the short term.

I believe in the site template's package.json, it's already pinned to 3.x, so we should be fine for the time being.

jaredcwhite avatar Jul 05 '22 18:07 jaredcwhite