tailwindlabs/tailwindcss

[Bug] Module build failed: Error: missing '{'

Gummibeer opened this issue · 5 comments

I've no idea if it's related to tailwind. At first I thought it's related to #48 but it seems that it's a different error!?
I get this error if I run yarn prod

ERROR in ./resources/assets/sass/app.scss
Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/resolve-url-loader/index.js):
Error: file:///resources/assets/sass/app.scss:3:412: missing '{'

webpack.mix.js

const mix = require('laravel-mix');
const tailwindcss = require('tailwindcss');
require('laravel-mix-purgecss');

mix
    .setPublicPath('public')
    .babel('resources/assets/js/app.js', 'public/js/app.js')
    .sass('resources/assets/sass/app.scss', 'css')
    .sass('resources/assets/sass/fonts.scss', 'css')
    .version()
    .options({
        processCssUrls: true,
        postCss: [ tailwindcss('./tailwind.config.js') ],
    })
    .purgeCss()
;

app.scss

@tailwind base;

@tailwind components;

@tailwind utilities;

In fonts.scss I use font awesome from node_modules. So I would like to let webpack copy the fonts. The error doesn't occur if I set processCssUrls: false.

Have you upgraded to the latest version of resolve-url-loader to see if that helps? Either way it's certainly an issue with that library and not Tailwind unfortunately.

These are my dev dependencies:

"devDependencies": {
  "cross-env": "^6.0.0",
  "laravel-mix": "^4.1.0",
  "laravel-mix-purgecss": "^4.1.0",
  "prettier": "^1.18.2",
  "resolve-url-loader": "^3.1.0",
  "sass": "^1.22.12",
  "sass-loader": "^7.3.1",
  "webpack": "^4.0.0"
}

Everything is/should be the latest available version. Thanks for the fast reply! <3 I will open an issue in resolve-url-loader repo.

Going to close as nothing we can do on our end unfortunately but if you want to post a GitHub repo that reproduces the issue I'd be happy to take a look in case I see a way to fix it for your project.

Hey, I've already created it for the other issue:
https://github.com/Gummibeer/tailwind-process-css-urls

@adamwathan would you want to add this solution to the docs?
laravel-mix/laravel-mix#2235 (comment)