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
[edge] vue-style-loader didn't discriminate between server and client #3804
Comments
Strange, if I turned off caching it worked. However, I still think it is an issue since caching and CSS generation should be able to co-exist. |
@stevefan1999 Hi, I want to confirm what Or could you provide a reproducible repo ? |
@clarkdo ahhh nevermind I made a reproduction demo on github anyway, see the updated info in the OP. |
I think this issue is related to I tried your repo, but cannot reproduce the issue, so could you confirm the thread-loader version in |
🤔Well, the version of thread-loader is indeed 1.2.0 {
"_from": "thread-loader@^1.2.0",
"_id": "thread-loader@1.2.0",
"_inBundle": false,
"_integrity": "sha512-acJ0rvUk53+ly9cqYWNOpPqOgCkNpmHLPDGduNm4hDQWF7EDKEJXAopG9iEWsPPcml09wePkq3NF+ZUqnO6tbg==",
"_location": "/thread-loader",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "thread-loader@^1.2.0",
"name": "thread-loader",
"escapedName": "thread-loader",
"rawSpec": "^1.2.0",
"saveSpec": null,
"fetchSpec": "^1.2.0"
},
"_requiredBy": [
"/nuxt-edge"
],
"_resolved": "https://registry.npmjs.org/thread-loader/-/thread-loader-1.2.0.tgz",
"_shasum": "35dedb23cf294afbbce6c45c1339b950ed17e7a4",
"_spec": "thread-loader@^1.2.0",
... And turning off parallel mode while leaving cache on does no good, but using parallel mode alone is okay. Edit: 😵Using WSL (and hence Linux) got both |
Actually I was using windows for reproducing your issue😢, but I cannot. Could you remove all node_modules and yarn.lock then reinstall them ? |
Purging my modules and reinstalling it did work for now. This is such a weird and subtle bug that there is no reliable way to reanimate it. Last time I received this error, the logging was:
I'd close this for being uncertain about reproducibility. However, I doubt it will ever happen again.🤔 |
I think I found a workaround: Just disable stylesheet caches on server-side: Add this to your nuxt.config.js: build: {
...
cache: true,
extend(config, { isServer, isDev, isClient }) {
...
if (isServer) {
for (const rules of config.module.rules.filter(({ test }) =>
/\.((c|le|sa|sc)ss|styl.*)/.test(test.toString())
)) {
for (const rule of rules.oneOf || []) {
rule.use = rule.use.filter(
({ loader }) => loader !== 'cache-loader'
)
}
}
}
...
}
...
} So this also implies that this crux of the problem actually lies on cache-loader...For some reason cache-loader incorrectly determined the current environment as |
Related to webpack-contrib/cache-loader#40 BTW, cache-loader can be disabled by build.cache: false |
@clarkdo Of course I want caches😥I'm working on a live reload environment (fortunately full reboot is reflected on server-side code only) and I cannot take that ~15s warmup time of Nuxt anymore... |
@stevefan1999 nicely done! I had a suspicion that it was related to cache but wasn't able to confirm. |
@stevefan1999 needed this fix when using latest nuxt-edge on linux |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Version
2.0.0-25586998.83d9dc4
Reproduction link
https://github.com/stevefan1999/nuxt-cache-bug-repo/tree/master/
Reproduction step
What is expected ?
"It just works"
What is actually happening?
It will show up this generic error regardlessly on any files that use styling:
Additional comments?
Somewhat related: vuejs/vue-style-loader#16
OS:
Microsoft Windows [Version 10.0.17134.165]
Node:
v10.9.0
Yarn:
1.9.4
The text was updated successfully, but these errors were encountered: