windicss / windicss-webpack-plugin

🍃 Windi CSS for webpack ⚡
https://windicss.org/integrations/webpack.html
79 stars 19 forks source link

fix: vue sfc custom block error #102

Closed winixt closed 2 years ago

winixt commented 2 years ago

/loaders/transform-template.js will cause the logic of the custom block of vue-loader to ignore:

image

Cause compilation failure.

harlan-zw commented 2 years ago

Thanks @winixt :) Merged

Do you have an example of the request that was triggering this though? I can't imagine any examples where this block doesn't handle it

  // make sure we're dealing with style-loader
  if (!remainingRequest.includes('&type=style'))
    return

Or do we need to explicitly return an empty string?

codecov-commenter commented 2 years ago

Codecov Report

Merging #102 (78501e5) into main (b35fbec) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #102   +/-   ##
=======================================
  Coverage   95.65%   95.65%           
=======================================
  Files           3        3           
  Lines          23       23           
  Branches        3        3           
=======================================
  Hits           22       22           
  Misses          1        1           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b35fbec...78501e5. Read the comment docs.

winixt commented 2 years ago

we use custom block config to config page route meta: image

compilation failure.

image

harlan-zw commented 2 years ago

Thanks for the example. Can you try with 1.5.7?

If it doesn't fix it then I'll have a way to replicate the problem now and can resolve it from there

winixt commented 2 years ago

it can't right work,if return undefinedwebpack will not skip after pitcher loader and normal loader.

image

https://webpack.js.org/api/loaders/#pitching-loader

Second, if a loader delivers a result in the pitch method, the process turns around and skips the remaining loaders. In our example above, if the b-loaders pitch method returned something:

winixt commented 2 years ago

oh on, empty string is removed by lint

harlan-zw commented 2 years ago

Ah, webpack pitching really is a fun time :eyes:

I'll push up a fix of that in one moment

harlan-zw commented 2 years ago

Alright, 1.5.8 should properly return an empty string. Let me know how it goes

winixt commented 2 years ago

Thanks, Works fine.

imshenshen commented 2 years ago

Thanks, Works fine.

https://github.com/windicss/windicss-webpack-plugin/issues/103