Typescript@beta moduleResolution nodenext strategy breaks @emotion
See original GitHub issueCurrent behavior:
- setting tsconfig.json.moduleResolution = node: everything is fine
- setting tsconfig.json.moduleResolution = nodenext: throws error
./src/app.tsx 13:2-15:21
[tsl] ERROR in /somedir/nirv/src/app.tsx(13,3)
TS2307: Cannot find module '@emotion/react/jsx-runtime' or its corresponding type declarations.
Expected behavior:
Environment information:
react
version:18.1@emotion/react
version:18.1- typescript: beta
- tsc: Version 4.7.0-dev.20220430
- pnpm: 6.32.9
** tsconfig **
{
"include": ["src"],
"exclude": ["src/**/*.test.ts"],
"compileOnSave": false,
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": true,
"baseUrl": "./",
"checkJs": false,
"esModuleInterop": true,
"exactOptionalPropertyTypes": false,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "nodenext", <-------- breaks @emotion
"noFallthroughCasesInSwitch": false,
"noImplicitAny": true,
"noImplicitOverride": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noPropertyAccessFromIndexSignature": false,
"outDir": "dist",
"paths": {},
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es2017",
"typeRoots": ["./src/@types", "./node_modules/@types"]
}
}
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Documentation - Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an import ... There are two possible module resolution strategies: Node...
Read more >cannot find module '@emotion/react/jsx-runtime' or its ...
emotion -js/emotionTypescript@beta moduleResolution nodenext strategy breaks @emotion#2742. Created 8 months ago. 6. Current behavior: setting tsconfig.json.
Read more >tsc-esm-fix - npm
meta is not allowed. esbuild/1043: empty output for interface files that breaks reimport. moduleResolution: nodenext. Nightly build TypeScript ...
Read more >Common TypeScript module problems and how to solve them
Enabling the compiler module resolution tracing in TypeScript can ... TypeScript will adopt the Node.js run-time resolution strategy by ...
Read more >TypeScript - xstyled
Read styled-components TypeScript guide to learn more about it. Use TypeScript with Emotion. Create a declaration file. // styled.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So the way to fix this would be to add the appropriate
package.json#exports
. This is, sort of, worked on here: https://github.com/preconstruct/preconstruct/pull/435Thanks for the report, I can confirm this is an issue. Minimal repro: https://github.com/srmagura/emotion-nodenext-repro