-
Notifications
You must be signed in to change notification settings - Fork 416
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
[Feature Request] supporting linara in vite react-ts template #735
Comments
I've had success in my personal projects using this plugin I made: https://github.com/denn1s/vite-plugin-linaria I'm open to collaborate and use it as a starting point for a more complete plugin down the line. |
Prepeding a forward slash to the filename fixes the problem with Vite: linaria/packages/rollup/src/index.ts Line 52 in 20e1ba5
Namely it should be like below for the plugin to work. const filename = `/${id.replace(/\.js$/, '')}_${slug}.css`; |
Now that this PR merged, import pluginLinaria from '@linaria/rollup';
import reactRefresh from '@vitejs/plugin-react-refresh';
import { defineConfig } from 'vite';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [reactRefresh(), pluginLinaria()],
}); |
Sorry. Not release yet. |
While
Using Anyone found a workaround? |
@mgcrea same issue for me. I fixed it by excluding .html files plugins: [
linaria({
exclude: ["**/*.html"],
}),
] |
@Platane can you share a working repository with Vite & Linaria? Thank yuou |
@glekner you can find an example in examples/vite |
@betterRunner did you fix the error? I'm trying to setup new React TS Vite project and I would like to use linaria but I can't make it working. I was following the https://github.com/callstack/linaria/tree/master/examples/vite but when I start the dev server I get this error:
|
@cojoclaudiu I run into this problem too. If your project is of
You might be able to remove |
Do you have a working sandbox? To be honest I gave up using linaria because I had to move on with the project. But I'm looking forward to use it for the future projects. |
@cojoclaudiu Hi there, sorry I haven't followed up on this issue for a while so I can't provide more details. Also waiting for updates. |
@betterRunner it should work now. Could you please check? |
I tried adding rollup plugin of linaria to vite template react-ts following https://github.com/callstack/linaria/blob/master/docs/BUNDLERS_INTEGRATION.md#Rollup without success.
When calling css of @linaria/core in App.tsx, an error like 'App.tsx_xxx.css is not found' occurred.
As vitejs/vite#1967 mentioned, it seems like linaria does not support vite yet (or did I miss sth)?
Thank you in advanced!
The text was updated successfully, but these errors were encountered: