-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Manually resolved path in CSS url() #831
Comments
Once you get to the point where an |
Ah but that would mean the path returned will be untouched. I need It works when importing into JS... import img from './user/avatar.png' will end with Not sure if that explained it any better |
You can do both. You can return a modified path and mark that modified path as external: build.onResolve({ filter: /\.png$/ }, args => {
let absPath = require('path').resolve(args.resolveDir, args.path)
return {
path: absPath.slice(absWorkingDir.length),
external: true,
}
}) |
Worked perfectly! Thank you! |
So I have a plugin that resolves all CSS
url()
directives to a custom URL path. For example:Which should return:
Now I know the
files
loader will rewrite the image file name, but I do not want that, and need to maintain the path structure, while also resolving relative and absolute paths.The problem I have is that the resulting CSS ends up being:
Which is incorrect.
Here's my plugin:
So even though I'm returning the
text
loader, it's converting it to a data URL. Is that expected behaviour?thanks in advance
The text was updated successfully, but these errors were encountered: