-
Notifications
You must be signed in to change notification settings - Fork 627
Description
I am interested in helping provide a fix!
Yes
Which generators are impacted?
- All
- Angular
- HTML
- Preact
- Qwik
- React
- React-Native
- Solid
- Stencil
- Svelte
- Vue
- Web components
Reproduction case
Expected Behaviour
I expect the CSS imports to stay in the file.
I'm not expecting anything fancy for Mitosis to handle CSS, but I needed the imports to remain in the file. Your docs show that is supposed to be a possibility: https://mitosis.builder.io/docs/components/#import-css-file
I thought that it was supposed to work that way, and weirdly enough, the Playground does show it working that way, but I was able to reproduce the issue following your Quickstart docs (see my additional info section).
I only tried this with React. I have not tried other frameworks/libraries for output.
Actual Behaviour
CSS imports are getting removed from the output.
Additional Information
I thought this was maybe just a problem in my project, but I created a completely separate test project from scratch using the Quickstart in your docs, and I was able to reproduce the issue. I tried to keep everything at defaults and only add my CSS import.
npm create @builder.io/mitosis@latest
> npx
> create-mitosis
┌ Welcome to Mitosis! Let's get started.
│
◇ What is your Mitosis project name?
│ my-project
│
◇ Select your desired outputs
│ react
│
◇ ────────────────────────────╮
│ │
│ Generating your template... │
│ │
├───────────────────────────────╯
│
◇ ────────────────────╮
│ │
│ Template generated! │
│ │
├───────────────────────╯
│
◇ Install dependencies?
│ Yes
│
◇ ─────────────────────────────────────────────────╮
│ │
│ Installing dependencies...this may take a while! │
│ │
├────────────────────────────────────────────────────╯
Then, in the my-project/library/src/autocomplete/autocomplete.lite.tsx file I added a import './test.css'; line:
import { For, onUpdate, Show, useStore } from '@builder.io/mitosis';
import './test.css';
export type Props = {
...
Then, the output file my-project/library/packages/react/src/autocomplete/autocomplete.tsx, had this content at the top (and test.css import is nowhere in the file):
"use client";
import * as React from "react";
import { useState, useEffect } from "react";
export type Props = {
...