-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Bun 1.2] relative links in css breaks the build #720
Comments
@AlbertSabate do you think it makes sense to report this error to Bun directly? I'm not sure how we can fix this on our part |
Maybe I can take a look at the CSS Parser and add the prefix to the correct absolute path, I'm going to take a look |
Probably we could yeah. I don't think it's brisa's problem either ... But would be nice to have it working until bunjs fixes the issue :/ For now I replaced it to absolute path and it works fine. I'm struggling with their css parser now. Maybe we can disable bun css parser optionally if we use tailwind????? |
Temporal workaround until a better fix is out: import tailwindcss from '@tailwindcss/postcss';
import type { Configuration } from 'brisa';
import postcss from 'postcss';
export default {
assetCompression: true,
clustering: false,
extendPlugins(plugins) {
return [
...plugins,
{
name: 'tailwindcss-adapter',
setup(build) {
build.onLoad({ filter: /\.(css)$/ }, async ({ path }) => {
const content = await Bun.file(path).text();
// @ts-ignore -- postcss types are not up to date
const contents = await postcss([tailwindcss]).process(content, {
from: path,
});
return {
contents: contents.css.replaceAll(':root', ':root, :host'),
loader: 'text',
};
});
},
},
];
},
} satisfies Configuration; import cssText from 'any.css' I came back to the origins, this solution always works. |
@AlbertSabate this should work now with integrations like Tailwind in 0.2.4-canary.5. In CSS integrations (Tailwind, PandaCSS) now we are using their parser, avoiding the CSS parser of Bun. The CSS Parser of Bun is used without integrations, so then is necessary to fix this relative path. Probably here we need to fix it inside a build plugin. So this issue is 50% solved. |
Describe the bug
When using a relative file in a url() from a css file, this breaks the build.
Add the following code in a .css
Remember to make sure the file exists in public folder.
Then when you try to build brisa the execution will break.
Should not break and build as normal if the file exists.
The text was updated successfully, but these errors were encountered: