🦹♂️ Twin blends the magic of Tailwind with the flexibility of css-in-js (emotion, styled-components, solid-styled-components, stitches and goober) at build time.
I'm trying to use twin in a new project in vite 5.0.0, I followed the example setup here but I'm getting some errors on console :
StyledComponent.ts:162 styled-components: it looks like an unknown prop "isActiveLink"
is being sent through to the DOM, which will likely trigger a React console error.
If you would like automatic filtering of unknown props, you can opt-into that behavior via
`<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)
Warning: React does not recognize the `isActiveLink` prop on a DOM element.
If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `isactivelink` instead.
If you accidentally passed it from a parent component, remove it from the DOM element.
The funny thing is that this is being rendered properly and no custom attributes are being passed to the DOM, however other components are being rendered with custom attributes for example this button :
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import svgr from 'vite-plugin-svgr';
import tsconfigPaths from 'vite-tsconfig-paths';
// https://vitejs.dev/config/
export default defineConfig({
optimizeDeps: {
esbuildOptions: {
target: 'es2020',
},
},
esbuild: {
// https://github.com/vitejs/vite/issues/8644#issuecomment-1159308803
logOverride: { 'this-is-undefined-in-esm': 'silent' },
},
plugins: [
react({
babel: {
plugins: [
'babel-plugin-macros',
'babel-plugin-styled-components',
],
},
}),
svgr({
// Set it to `true` to export React component as default.
// Notice that it will overrides the default behavior of Vite
// svgr options: https://react-svgr.com/docs/options/
svgrOptions: {
icon: true,
dimensions: false,
},
// esbuild options, to transform jsx to js
esbuildOptions: {
// ...
},
// A minimatch pattern, or array of patterns,
// which specifies the files in the build the plugin should include.
// By default all svg files will be included
include: '**/*.svg?react',
// A minimatch pattern, or array of patterns, which specifies the files
// in the build the plugin should ignore
// By default no files are ignored
exclude: '',
}),
tsconfigPaths(),
],
});
I'm trying to use twin in a new project in vite 5.0.0, I followed the example setup here but I'm getting some errors on console :
this is the component related to the error :
The funny thing is that this is being rendered properly and no custom attributes are being passed to the DOM, however other components are being rendered with custom attributes for example this button :
is being rendered with custom
btnsize
andbtnstyle
attributes :In some instances the button has the correct styles applied, sometimes not. I'm wondering how can I fix this?
my package.json :
vite.config.js :