Skip to content

Webpack watch breaks when @apply'ing a non-existing class. #98

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

Closed
1player opened this issue Nov 5, 2017 · 4 comments
Closed

Webpack watch breaks when @apply'ing a non-existing class. #98

1player opened this issue Nov 5, 2017 · 4 comments

Comments

@1player
Copy link

1player commented Nov 5, 2017

First of all, thanks for this great project, I've been waiting for this since ages!

I don't know if I'm reporting this in the correct place, but my problem is this: if in my component I @apply a class that does not exist, I get an error such as:

ERROR in ./css/app.css
Module build failed: ModuleBuildError: Module build failed: Syntax Error

(3:3) No .foo class found.

and my webpack watch breaks, and does not pick up further changes until I stop and restart webpack.

I think it's because of Tailwind's implementation of @apply, which completely break the webpack watcher until the error is fixed and webpack restarted.

Any easy workaround for the time being? It's a bit frustrating to stop and restart webpack everytime I add a typo in my components.

How can I help?

@1player
Copy link
Author

1player commented Nov 5, 2017

Mmmm.. spent more time on this, and it seems this happens only on an @apply error in an @imported CSS file.

If I have a typo in my main css file, rebuild after error works.

I'm using postcss-easy-import which is basically postcss-import with globs, the problem is probably there. I'll report back.

@1player 1player closed this as completed Nov 5, 2017
@1player
Copy link
Author

1player commented Nov 5, 2017

Couldn't make it work with postcss-import. I've resolved by converting all my stylesheets to SASS and using it to concatenate imports, which are then processed by postcss and tailwind.

Here's my webpack rules:

 // Preloader to support globbed @import on SASS
      {
        test: /\.s?css$/,
        enforce: "pre",
        loader: "import-glob-loader"
      },
      {
        test: /\.s?css$/,
        use: ExtractTextPlugin.extract({
          fallback: "style-loader",
          use: ["css-loader", "postcss-loader", "sass-loader"]
        })
      }

And my main CSS:

@tailwind preflight;

@import "./components/*";

@tailwind utilities;

@import "./utilities";

@1player
Copy link
Author

1player commented Nov 5, 2017

Pinging #53 since I originally got the idea of using postcss-import from there.

@sebastiandedeyne
Copy link
Contributor

I have the same issue that webpack sopts watching... It's not a dealbreaker but kind of annoying every time I need to restart the process.

DCzajkowski pushed a commit to DCzajkowski/tailwindcss that referenced this issue Jul 23, 2019
Replace bg-blue-light with bg-blue-400
RobinMalfait pushed a commit that referenced this issue May 10, 2025
Here is everything you need to know about this upgrade. Please take a
good look at what changed and the test results before merging this pull
request.

### What changed?




#### ✳️ dedent (1.5.3 → 1.6.0) · [Repo](https://github.com/dmnd/dedent)
· [Changelog](https://github.com/dmnd/dedent/blob/main/CHANGELOG.md)



<details>
<summary>Release Notes</summary>
<h4><a
href="https://github.com/dmnd/dedent/releases/tag/v1.6.0">1.6.0</a></h4>

<blockquote><h2 dir="auto">What's Changed</h2>
<ul dir="auto">
<li>feat: add <code class="notranslate">trimWhitespace</code> option by
<a href="https://bounce.depfu.com/github.com/43081j">@43081j</a> in <a
href="https://bounce.depfu.com/github.com/dmnd/dedent/pull/97">#97</a>
</li>
</ul>
<h2 dir="auto">New Contributors</h2>
<ul dir="auto">
<li>
<a href="https://bounce.depfu.com/github.com/43081j">@43081j</a> made
their first contribution in <a
href="https://bounce.depfu.com/github.com/dmnd/dedent/pull/97">#97</a>
</li>
</ul>
<p dir="auto"><strong>Full Changelog</strong>: <a
href="https://bounce.depfu.com/github.com/dmnd/dedent/compare/v1.5.3...v1.6.0"><tt>v1.5.3...v1.6.0</tt></a></p></blockquote>
<p><em>Does any of this look wrong? <a
href="https://depfu.com/packages/npm/dedent/feedback">Please let us
know.</a></em></p>
</details>

<details>
<summary>Commits</summary>
<p><a
href="https://github.com/dmnd/dedent/compare/90644fe0be6ed6c159efe8c905f491ba26c51c35...ab2ce25762a6ad0c26c563075f87c74427092d02">See
the full diff on Github</a>. The new version differs by 2 commits:</p>
<ul>
<li><a
href="https://github.com/dmnd/dedent/commit/ab2ce25762a6ad0c26c563075f87c74427092d02"><code>1.6.0
(#98)</code></a></li>
<li><a
href="https://github.com/dmnd/dedent/commit/86902f7c97f32e91e5a9c2c6982a73a8a4a32b67"><code>feat:
add `trimWhitespace` option (#97)</code></a></li>
</ul>
</details>












---
![Depfu
Status](https://depfu.com/badges/edd6acd35d74c8d41cbb540c30442adf/stats.svg)

[Depfu](https://depfu.com) will automatically keep this PR
conflict-free, as long as you don't add any commits to this branch
yourself. You can also trigger a rebase manually by commenting with
`@depfu rebase`.

<details><summary>All Depfu comment commands</summary>
<blockquote><dl>
<dt>@​depfu rebase</dt><dd>Rebases against your default branch and
redoes this update</dd>
<dt>@​depfu recreate</dt><dd>Recreates this PR, overwriting any edits
that you've made to it</dd>
<dt>@​depfu merge</dt><dd>Merges this PR once your tests are passing and
conflicts are resolved</dd>
<dt>@​depfu cancel merge</dt><dd>Cancels automatic merging of this
PR</dd>
<dt>@​depfu close</dt><dd>Closes this PR and deletes the branch</dd>
<dt>@​depfu reopen</dt><dd>Restores the branch and reopens this PR (if
it's closed)</dd>
<dt>@​depfu pause</dt><dd>Ignores all future updates for this dependency
and closes this PR</dd>
<dt>@​depfu pause [minor|major]</dt><dd>Ignores all future minor/major
updates for this dependency and closes this PR</dd>
<dt>@​depfu resume</dt><dd>Future versions of this dependency will
create PRs again (leaves this PR as is)</dd>
</dl></blockquote>
</details>

Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants