-
-
Notifications
You must be signed in to change notification settings - Fork 384
Misleading error, when used with html-webpack-plugin
#489
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
Comments
Looks like problem in |
Without MCEP loader it works correctly, but didn't emit CSS chunk |
@evilebottnawi should this config actually work? Or MCEP is not intended to emit CSS chunks together with HWP? |
@ogonkov i think something wrong in HWP, i will look at this in near future |
html-webpack-loader
html-webpack-plugin
Should i add this MCEP+HWP usage to tests? |
CSS-related issues in
Issues in
|
I believe that importing same template from JS didn't throw error, so probably @evilebottnawi could be right here (still don't know how to debug this issue, to make sure). |
At Console output
|
Probably related: #73 |
Looks like problem mutated? |
I believe bug (with misleading error) was introduced in #448 |
I believe that error thrown from Callback is first called in If i put console log on 1020 it shows that css file come here twice. Second invocation is seems to come from loader child compiler callback invocation (redundant?) |
@evilebottnawi did you have a chance to look to this issue? |
I ended up just moving all my |
Try to find time in near future, a lot of work, sorry |
If this helps, I created one more minimal test case: |
Hit that issue as well, cost me a few hours already :-( Thanks @ogonkov for reporting with reproducer. @klesun a viable workaround (works for me) might be to replace
If you also have regular JS imports then of course 2 distinct CSS rules are required. UPDATE: just found that stackoverflow entry... ;-) Hopefully still useful to have the workaround detailed here. |
@geonanorch Though, as I found later, |
@ogonkov sorry for delay, a lot of work, can you send a PR? |
@evilebottnawi I have no idea how to fix it. May be you can give some hint to what is going wrong? |
no problems on webpack@5 😕 |
Yep, bug on need to change on
|
/cc @jantimon Why we don't use |
With See the "Template language support" section of https://dev.to/jantimon/html-webpack-plugin-4-has-been-released-125d |
I have filed another bug in |
@jantimon something wrong in design |
But we will probably need child compilations for ssr. Isn't |
pitch phase do not break SSR
Yes, it is exclude pre loader and normal loader, but because you will use |
@evilebottnawi, I think this is still a problem of MCEP. Simply say, MCEP do not support child compilation. HWP use child compilation to parse html and its dependencies, and MCEP didn't add the CssDependency (& factory) to Maybe, change the hook of If child compilation exists, should not MCEP support it? |
@zhenhen yes, but in theory other nested child compilations can be used, there are problem in |
I can confirm that changing
|
@IgnusG can you provide minimum reproducible test repo? |
I’ll try and reduce the build code and create a playground repo. Will probably take me some time |
Unfortunately spoke too soon. Changing the hook indeed fixes the compilation and all files are properly emitted but the identifier inside the requiring file gets changed from the original |
I've narrowed the problem down to I've modified this behaviour to always use the last one (excluding source maps) - honestly have no idea what implications that has - but now (together with changing
|
When I use style-loader I get "ReferenceError: document is not defined". |
With all the latest packages installed this error is not appear anymore. But CSS is not emitted either. I think i will recreate this issue, because original error is gone. |
I found it was not VUE CLI problem but the git shell issue. I just closed the git shell window and opened it again and then this error was gone. NOTE that I had other similar project open earlier and I had swithed to this project by doing cd../current_project. Hope this helps. |
macOS 10.15.2
v10.17.0
6.11.3
[email protected]
[email protected]
[email protected]
Expected Behavior
Error thrown that lead to something meaningful (still not sure what actually goes wrong)
Actual Behavior
Thrown the error in some third-party lib
Code
https://gist.github.com/ogonkov/2e23941414d6f0b3d5328bd80cba5674
How Do We Reproduce?
npm i
npm run build
The text was updated successfully, but these errors were encountered: