JSX (TSX) not resolved
See original GitHub issueHi, I’m trying to make this work with my project, but again I cannot make the JSX to resolve.
On contrary to #92 when I add ‘import ./a.jsx’ it works for jsx but that’s not the solution as I need it to import by default. The TS and TSX solution does not work at all as it is not even resolving TS and TSX to supply to “ts-loader”
I even added my own webpack.config.js with a following content but I still have to explicitly specify import ./a.jsx
. This is a no-go for me since I’m compiling files from typescript.
const path = require('path');
module.exports = {
module: {
resolve: {
extensions: ['', '.js', '.jsx']
},
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
query: { presets: ['react', 'es2015', 'stage-2'] },
exclude: [path.resolve('./node_modules'), path.resolve(__dirname, 'node_modules')],
include: [path.resolve('./'), __dirname],
},
{
test: /\.css?$/,
loaders: [ 'style', 'raw' ],
include: path.resolve(__dirname, '../')
}
]
}
};
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:10 (10 by maintainers)
Top Results From Across the Web
React can't resolve .tsx files - Stack Overflow
I just came across this problem as well, with a brand new React project. Temporarily downgrading react-scripts from version 5.0.0 to 4.0.3 ...
Read more >TypeScript source resolution does not work with jsx #6866
js it will not resolve to ./MyComponent.tsx it will try and look for ./MyComponent.ts which does not exist. I believe the issue is...
Read more >Module not found: Can't resolve 'react/jsx-runtime' | bobbyhadz
To solve the error "Module not found: Error: Can't resolve 'react/jsx-runtime'", make sure to update the react package by opening your terminal in...
Read more >Troubleshooting | React Navigation
Sometimes it might even be due to a corrupt installation. If clearing cache didn't work, try deleting your node_modules folder and run npm...
Read more >Tutorial: Create a Node.js and React app in Visual Studio
tsx and not webpack:///./app.tsx, which prevents the Visual Studio debugger from locating app.tsx. Or, try using the debugger; statement in app.
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
SOLVED. I disected the way you compose the final config and following works (please see the “resolve” section in the parent of the child configuration):
@tomitrescak, try to add few more lines to your code: