You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using nextjs 14 and twin.macro to create nextjs packages which i can then install to all my projects. as long as i'm in dev mode (npm run dev) and import components from src folder, it's working fine. As soon as i do npm run build and compile my components to eg. "/dist" folder and try to import it from there, i'm getting an error: TypeError: Unable to determine current node version .
This is my tsconfig.json:
{ "include": ["components", "types"], "exclude": ["dist", "node_modules"], "compilerOptions": { "module": "commonjs", "lib": ["dom", "es2015", "es2016", "es2017", "es2021", "esnext.asynciterable"], "importHelpers": true, "declaration": true, "sourceMap": false, "rootDir": "./components", "outDir": "./dist/esm", "strict": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "noUnusedLocals": true, "noImplicitAny": true, "noUnusedParameters": true, "strictNullChecks": true, "moduleResolution": "node", "target": "es6", "jsx": "react-jsx", "esModuleInterop": true, "allowSyntheticDefaultImports": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true } }
Maybe some options are useless because i was trying so many combinations of settings. The compiled component actually looks ok (like when you do it with styled-components) but with twin.macro styled components i'm getting the error mentioned above.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using nextjs 14 and twin.macro to create nextjs packages which i can then install to all my projects. as long as i'm in dev mode (
npm run dev
) and import components from src folder, it's working fine. As soon as i donpm run build
and compile my components to eg. "/dist" folder and try to import it from there, i'm getting an error:TypeError: Unable to determine current node version
.This is my
tsconfig.json
:{ "include": ["components", "types"], "exclude": ["dist", "node_modules"], "compilerOptions": { "module": "commonjs", "lib": ["dom", "es2015", "es2016", "es2017", "es2021", "esnext.asynciterable"], "importHelpers": true, "declaration": true, "sourceMap": false, "rootDir": "./components", "outDir": "./dist/esm", "strict": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "noUnusedLocals": true, "noImplicitAny": true, "noUnusedParameters": true, "strictNullChecks": true, "moduleResolution": "node", "target": "es6", "jsx": "react-jsx", "esModuleInterop": true, "allowSyntheticDefaultImports": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true } }
Maybe some options are useless because i was trying so many combinations of settings. The compiled component actually looks ok (like when you do it with
styled-components
) but withtwin.macro
styled components i'm getting the error mentioned above.Beta Was this translation helpful? Give feedback.
All reactions