Comments (6)
Mhmm, I think the current behavior is correct. CSS does not distinguish between url('file.jpg')
and url('./file.jpg')
. That's why an empty string ''
should be equivalent to './'
. Could you describe your use-case? Why do you have an empty url()
statement—and how is webpack supposed to handle an empty request?
from loader-utils.
Ah ok ... this was an error in the first place. What error does webpack report in this case?
from loader-utils.
Webpack doesn't report any errors but proceeds to trying to require './
even if it's a JS file.
The original issue was here: facebook/create-react-app#1875. The url('')
was a mistake but lead to a very hard-to-find bug.
Webpack currently warns if somebody does a require('')
(webpack/webpack#2006).
Maybe we should warn if somebody tries to rewrite ''
?
from loader-utils.
Yeah, I totally see that. While transforming ''
to './'
is theoretically correct, it is most likely an error.
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.
from loader-utils.
@darrenscerri Would you be up to a pull-request? Should be a small change...
from loader-utils.
@jhnns Added pull-request
from loader-utils.
Related Issues (20)
- loaderUtils.getOptions is not a function HOT 1
- Prettier show all files with error because of default HOT 3
- Missing getOptions.js in lib ? HOT 5
- CVE-2021-44906 HOT 4
- [CVE-2022-37599]/ReDos found in interpolateName.js HOT 8
- [CVE-2022-37601]/Prototype pollution found in parseQuery.js HOT 15
- [CVE-2022-37603]/ReDoS found in interpolateName.js HOT 9
- CVE-2022-37599 - security vulnerability across all loader-utils HOT 13
- Known regex vuln HOT 5
- Security Vulnerabilities issue HOT 42
- Fix vulnerability in v1 of loader-utils HOT 2
- contenthash vs hash? HOT 1
- Does this don't need translation? `\[`
- is 2.0.4 in the NPM registry? HOT 4
- Create types package for loader-utils@3 HOT 2
- Error while installing vue-style-loader which uses loader-utils HOT 1
- loader-utils stable version is 3.2.1 which has dependency on JSON5 2.2.1 which has Published Vulnerabilities CVE-2022-46175 (OSSINDEX) HOT 4
- Failed to resolve entry for package "crypto" HOT 1
- Create a Security Policy HOT 1
- CVE-2022-46175 - High HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loader-utils.