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
DebugEngine/css-to-js-sourcemap throws lots of errors with latest nextjs (react fast refresh?) #366
Comments
Thanks for the report. I think this must be something different from rtsao/css-to-js-sourcemap#41 (comment) since it gets past the TypeError and actually attempts to fetch these URLs. I'm thinking is this is related to how Next.js is producing source maps. css-to-js-sourcemap should only be fetching the actual JS bundles (not the fake URLs supplied by webpack). I assume this is minimally reproducible with a simple app using Next.js and baseui? |
I'm also getting this in a Next.js app so you could be on to something there. It does reproduce with a very simple app: https://github.com/tajo/nextjs-baseweb |
Hmm, I just tried reproducing with that repo by editing some files but no luck seeing any errors. Any particular reproduction steps that work for you? |
Sorry my bad, try this one: https://github.com/jgillich/nextjs-baseweb The only difference is the use of toaster and ToasterContainer. Maybe we have yet another issue with toaster here? https://github.com/uber/baseweb/issues/3430 |
Actually no, what triggered this was the dependency version upgrade. Upgrade everything in tajo/nextjs-baseweb with a tool like npm-check-updates and you should be able to reproduce. |
Thanks, I can reproduce now. It seems something changed with stack trace URLs between Logging out Next 9.3.2:
Next 9.4.4:
The key difference is the URLs have been changed from The quick fix would be to simply ignore any URLs with non http(s) protocol, which would solve the errors but the DevTool would still not work because it needs to be able to fetch the source maps for the original source. I still need to look further into why this is now different and if there's anything we can do from our end. |
They started using module.exports = {
webpack: (config, {dev}) => {
if (dev) {
config.devtool = 'inline-source-map';
}
return config;
},
}; I'm probably just going to update our examples and will report it to them but not sure if they are willing to revert it for I already updated tajo/nextjs-baseweb. |
The fix worked well up to nextjs v9.4.4 but with v9.5.0 changes to webpack devtool in development are reverted:
|
Yea, unfortunately this is still a problem with Next.js (including v10). They changed the source map format and don't allow any customization. As @rtsao described that's not compatible with the current approach using worker and fetching source code. Frankly, I am not sure if there's a fix we could make. This feature is nice to have but not absolutely critical? Afaik some CSS in JS libraries like styled-components don't have it, others use build time solutions using babel. Maybe we could do something like that? Anyway, Ryan might have some better ideas. For now, I am going to remove DebugEngine from all Next.js examples/templates and add a disclaimer that certain source map format is expected. |
[DebugEngine stopped working](styletron/styletron#366) with v9.5 since the devtool is strictly set to eval and this option is not customizable. Unfortunately there is no currently no fix.
Gotcha, thanks for the quick response @tajo |
[DebugEngine stopped working](styletron/styletron#366) with v9.5 since the devtool is strictly set to eval and this option is not customizable. Unfortunately there is currently no way to fix this.
We have a pretty big project using styletron, which uses css-to-js-sourcemap. It's built on nextjs 9.4.2, which uses webpack 4.
The worker throws hundreds of these errors which understandably makes the console a mess and the debugging tools quite difficult to use. The fetch errors are thrown by styletron-react's use of the css-in-js-worker library as noted by this comment rtsao/css-to-js-sourcemap#41 (comment)
For now, avoiding using of
DebugEngine
is the best solution for this problem.The text was updated successfully, but these errors were encountered: