-
-
Notifications
You must be signed in to change notification settings - Fork 187
Empty string is rewritten as './' in urlToRequest #80
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
Mhmm, I think the current behavior is correct. CSS does not distinguish between |
Ah ok ... this was an error in the first place. What error does webpack report in this case? |
Webpack doesn't report any errors but proceeds to trying to require The original issue was here: facebook/create-react-app#1875. The Webpack currently warns if somebody does a Maybe we should warn if somebody tries to rewrite |
Yeah, I totally see that. While transforming I thought about throwing an error if an empty url is passed, but that wouldn't be very pleasant to use and it would be a breaking change since the call needs to be wrapped in try/catch. Maybe it's best to just keep it as it is and let webpack handle it correctly (as you suggested)... not the most beautiful solution 😞, but it would probably work. |
@darrenscerri Would you be up to a pull-request? Should be a small change... |
@jhnns Added pull-request |
Prior to this commit, `urlToRequest` rewrote an empty URL `''` to `'./'` which is correct from a theoretical point of view since CSS files do not distinguish between relative paths starting with ./ or not (like CommonJS does). However, an empty URL is most likely an error which webpack should warn about. If we rewrite the empty string to ./, webpack won't warn against this anymore because requiring ./ is valid. Related discussion: #80
Related issue: webpack-contrib/css-loader#463
Calling
urlToRequest
with an empty string resolves to./
. This behaviour should not be allowed, or rather keep as an empty string and let Webpack handle it.The text was updated successfully, but these errors were encountered: