astroturfcss / astroturf

Better Styling through Compiling: CSS-in-JS for those that want it all.
https://astroturfcss.github.io/astroturf/
MIT License
2.28k stars 60 forks source link

Astroturf loader v.1.0.0 is broken on Webpack v4.x #740

Closed Skakruk closed 2 years ago

Skakruk commented 2 years ago

Getting

Module build failed (from ../node_modules/astroturf/loader.js):
TypeError: this.getOptions is not a function
    at Object.astroturfLoader (./node_modules/astroturf/loader.js:8:12)
 @ multi ../node_modules/webpack-dev-server/client?http://0.0.0.0:2001 ../node_modules/webpack/hot/dev-server.js ../node_modules/preact-cli/lib/lib/entry bundle[1]

Seems this.getOptions() is available only since Webpack v5 https://webpack.js.org/api/loaders/#thisgetoptionsschema

Since webpack 5, this.getOptions is available in loader context. It substitutes getOptions method from loader-utils.

This is caused by this change - https://github.com/4Catalyzer/astroturf/commit/20760a704313f4a4815a21d8324ca8695a5809bf#diff-0a1342822ff2e711a79fd7036fdc352146751bd42d7d5845a2938f903723f74bR4

jquense commented 2 years ago

sorry astroturf doesn't support webpack 4 at this point. consider upgrading!