'Tailwind / Webpack / Gatsby - CssSyntaxError when compiling Tailwind CSS
I'm using Tailwind on a Gatsby site and this has been compiling fine but just started throwing the following error on develop and build cycles:
ERROR #98123 WEBPACK
Generating development JavaScript bundle failed
File: ..\themes\@mytheme\gatsby-theme-mytheme\src\styles\global.css:1:0
failed Building development bundle - 158.060s
ERROR in ../themes/@mytheme/gatsby-theme-mytheme/src/styles/global.css
Module build failed (from ../node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ../node_modules/css-loader/dist/cjs.js):
CssSyntaxError
Module build failed (from ../node_modules/css-loader/dist/cjs.js):
CssSyntaxError
(1:0) C:\FILES- GIT\Clients\Project\www.mysite.com - THEME BUILD\themes\@mytheme\gatsby-theme-mytheme\src\styles\<no source> Unclosed bracket
(1:0) C:\FILES- GIT\Clients\Project\www.mysite.com - THEME BUILD\themes\@mytheme\gatsby-theme-mytheme\src\styles\<no source> Unclosed bracket
at processResult (C:\LineIndustries - GIT\Clients\Pan Macmillan\www.panmacmillan.com - THEME BUILD\node_modules\webpack\lib\NormalModule.js:758:19)
at C:\FILES- GIT\Clients\Project\www.mysite.com - THEME BUILD\node_modules\webpack\lib\NormalModule.js:860:5
at C:\FILES- GIT\Clients\Project\www.mysite.com - THEME BUILD\node_modules\loader-runner\lib\LoaderRunner.js:400:11
at C:\FILES- GIT\Clients\Project\www.mysite.com - THEME BUILD\node_modules\loader-runner\lib\LoaderRunner.js:252:18
at context.callback (C:\FILES- GIT\Clients\Project\www.mysite.com - THEME BUILD\node_modules\loader-runner\lib\LoaderRunner.js:124:13)
at Object.loader (C:\FILES- GIT\Clients\Project\www.mysite.com - THEME BUILD\node_modules\css-loader\dist\index.js:155:5)
@ ../themes/@mytheme/gatsby-theme-mytheme/gatsby-browser.js 5:0-33
@ ./.cache/api-runner-browser-plugins.js 69:10-91
@ ./.cache/api-runner-browser.js 4:14-53
@ ./.cache/app.js 12:0-65 29:87-33:1 37:20-29 50:0-14 116:17-26 150:6-15 29:0-33:2
In my global CSS file I import the Tailwind core CSS in the following way:
@tailwind base;
@tailwind components;
@tailwind utilities;
Removing the line for 'utilities' stops the error but obviously removes half the tailwind core CSS. This would seem to suggest there's a CSS syntax error in the Tailwind core utilities file but I find this hard to believe. This has worked previously and nothing else has changed in the project as far as I'm aware.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
