examples icon indicating copy to clipboard operation
examples copied to clipboard

Vite + Styled Components Example

Open seanmcquaid opened this issue 2 years ago • 7 comments

More of a request but is there any chance we can get an ideal example for using Styled Components with Vite? I tried my hand at it but would love to see something here to go off of.

seanmcquaid avatar Nov 02 '23 19:11 seanmcquaid

Update on this, might have a working example that follows some previous code ya'll added! Going to try and contribute an example for this when I get some time

seanmcquaid avatar Nov 03 '23 03:11 seanmcquaid

this one works for me import react from '@vitejs/plugin-react'; import { defineConfig } from 'vite';

// https://vitejs.dev/config/ export default defineConfig({ plugins: [ react({ include: /.(jsx|tsx)$/, babel: { plugins: ['styled-components'], babelrc: false, configFile: false, }, }), ], });

Amadeo-Frontend avatar Nov 07 '23 01:11 Amadeo-Frontend

@seanmcquaid hey, have you figured out how to make Remix + Vite work with styled-components?

SilencerWeb avatar Feb 29 '24 10:02 SilencerWeb

I did! Here are the links to the entry.server.tsx + root.tsx files, it was really just following what was already in place.

https://github.com/seanmcquaid/remix-unstable-vite-playground/blob/main/app/entry.server.tsx#L38-L55

https://github.com/seanmcquaid/remix-unstable-vite-playground/blob/main/app/root.tsx#L37

seanmcquaid avatar Mar 01 '24 01:03 seanmcquaid

This solution worked for me: https://github.com/styled-components/styled-components/issues/4275

wilk avatar Aug 20 '24 09:08 wilk