Closed Rigel772 closed 1 year ago
It seems that there is no suitable loader to handle css. I am not familiar with astro js. Maybe there is a corresponding switch to enable or customize related compilation configuration. You can look for their official website documents or issue documents with similar problems. .
Thank you for your response @pointhalo Could you tell me how the css should be loaded? I can see in their documentation: Astro supports CSS preprocessors such as Sass, Stylus, and Less through Vite I would understand if the styles would NOT loading... but why the error? Can you point me in the right direction, please?
Honestly, I don't know how to configure it either. I took a look at the docs of astro js and found that they don't seem to expose this kind of configuration.
I guess that it does not support the js file under node_modules to import css by itself
The code structure of semi is as follows
-- component
- button
- button.js
- button.css
The js file of each component will be responsible for importing its own css, which is similar to the component module you write yourself
// button.js
import './button.css';
class Button extend React. Component {xxx}
In the react projects of webpack, vite, and create-react-app, they can run directly without any configuration.
Remix and nextjs have sideeffect css import restrictions by default, but there are configurations for users to exempt.
At present, astro.js does not have such functions for the time being (I am still new to astro and am not familiar with it, please correct me if my conclusion is wrong)
From our point of view, astro should consider the scenario of importing css in js to be a more reasonable solution (similar to next and remix, and finally provide support from framework layer compilation) We have no plan to specialize the engineering solution of the component library in order to adapt to the astro framework. This issue will be closed.
Is there an existing issue for this?
Which Component
any
Semi Version
"@douyinfe/semi-ui": "^2.31.0"
Current Behavior
Please see: https://stackblitz.com/edit/github-abxdmr-dkqrpd?file=src%2Fcomponents%2FSemi.jsx,package.json On local astro instalation the error is more verbose:
Expected Behavior
To see button rendered:
Steps To Reproduce
ReproducibleCode
Environment
Anything else?
No response