Comments (3)
I've include the a full error dump below. Also here is a repo where the bug should be able to be replicated.
event - compiled client and server successfully in 819 ms (180 modules)
error - src/pages/index.tsx (15:37) @ eval
error - Error [TypeError]: (0 , _stitches_config_ts__WEBPACK_IMPORTED_MODULE_1__.styled)(...) is not a function
at eval (webpack-internal:///./src/pages/index.tsx:43:95)
at Function.__webpack_require__.a (/Users/will/Development/next-stitches-typescript-bug-example/.next/server/webpack-runtime.js:97:13)
at eval (webpack-internal:///./src/pages/index.tsx:1:21)
at Object../src/pages/index.tsx (/Users/will/Development/next-stitches-typescript-bug-example/.next/server/pages/index.js:52:1)
at __webpack_require__ (/Users/will/Development/next-stitches-typescript-bug-example/.next/server/webpack-runtime.js:33:42)
at __webpack_exec__ (/Users/will/Development/next-stitches-typescript-bug-example/.next/server/pages/index.js:92:39)
at /Users/will/Development/next-stitches-typescript-bug-example/.next/server/pages/index.js:93:28
at Object.<anonymous> (/Users/will/Development/next-stitches-typescript-bug-example/.next/server/pages/index.js:96:3)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.requirePage (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/require.js:134:12)
at /Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/load-components.js:51:73
at async Object.loadComponentsImpl [as loadComponents] (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/load-components.js:51:26)
at async DevServer.findPageComponentsImpl (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/next-server.js:667:36)
at async DevServer.findPageComponents (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/dev/next-dev-server.js:1248:20)
at async DevServer.renderPageComponent (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/base-server.js:1187:24)
at async DevServer.renderToResponseImpl (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/base-server.js:1230:32)
at async DevServer.pipeImpl (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/base-server.js:548:25)
at async Object.fn (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/next-server.js:1030:21)
at async Router.execute (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/router.js:297:32)
at async DevServer.runImpl (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/base-server.js:522:29)
at async DevServer.run (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/dev/next-dev-server.js:869:20)
at async DevServer.handleRequestImpl (/Users/will/Development/next-stitches-typescript-bug-example/node_modules/next/dist/server/base-server.js:456:20) {
digest: undefined
}
13 | const ButtonBox = tw.div`flex flex-col justify-center h-full gap-y-5`
14 |
> 15 | const CustomButtonBox = tw(ButtonBox)`bg-black`
| ^
16 |
17 | const IndexPage = () => (
18 | <Container hasBackground>
from twin.macro.
Thanks for the examples - I also replicated it in the stitches example.
Looking at the generated code, it all looks okay and no different than what's generated for emotion/styled-components and both I've tested and don't cause that webpack error.
Will have to look into this further.
from twin.macro.
Looking at the generated code, it all looks okay and no different than what's generated for emotion/styled-components
@ben-rogerson It does generate similar code to with emotion/styled-components, but this is also the problem - Stitches doesn't use the same syntax here, it doesn't support using styled(Component)
as a function (as in styled(Component)(styles)
. You can only use syntax similar to the workaround mentioned by @wmcb91 using 2 parameters: styled(Component, styles)
.
It looks like you've already took note of this for the dot syntax:
Line 35 in b1258e7
from twin.macro.
Related Issues (20)
- NX React - Module '"twin.macro"' has no exported member 'styled' HOT 1
- DaisyUI 3.x Tooltip dynamic variant not working
- `group-x` classes containing `/` aren't working correctly
- Support for @headlessui/tailwindcss prefixes in inner classes HOT 2
- the name `_GlobalStyles` is defined multiple times HOT 1
- Doesn't work with CodeSandbox React template HOT 1
- Error when passing props to the css attribute in solid/stitches HOT 3
- CSS `calc` with more than 2 `theme` keywords HOT 1
- Can't resolve 'v8' (Twin + Next.js + Styled Components) HOT 9
- Twin Macro Doesn't Work With Next.js (A Working Example Would Solve This) HOT 6
- Dynamic is not working as expected in next-emotion-typescript HOT 2
- Module not found: Can't resolve 'v8' HOT 3
- Property 'cs' is missing in type.... HOT 2
- Next 14 layout shift (maybe css load after render) HOT 2
- Jest testing (typescript) - twin_macro_1.theme is not a function HOT 2
- Errors in vite 5.0.0 HOT 1
- TypeScript type error with TwImportComponent in jest-testing-typescript
- CSS fallback values from Tailwind config `extend` are missing HOT 2
- Props don't get passed down when composing components HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twin.macro.