-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No syntax highlighting for tsx files #3333
Comments
There isn't really anything we can do here, Parcel emits source maps with the filename and the file contents as a string, the syntax highlighting is done by Chrome. This SO answer says that the mimetype with which the tsx file is served makes a difference: https://stackoverflow.com/questions/53397337/in-chrome-devtools-in-all-my-tsx-source-files-syntax-highlighting-and-intellis |
If the mimetype is the problem, maybe that can be configured here? https://github.com/parcel-bundler/parcel/blob/master/packages/core/parcel-bundler/src/Server.js I can have a little look later on. |
Not sure what I was thinking when writing that post, but there is no tsx mimetype involved in this case. The Parcel dev-server serves the transpiled js (not tsx) bundle and the corresponding source map file, which is a JSON file with basically these contents: {
"sources": [
"index.tsx",
],
// ...
"sourcesContent": [
"console.trace(\"hello from index.tsx!\");",
]
} You should file a bug with Chrome. (Firefox correctly highlights the tsx file in devtools) |
For anyone else having this problem, this is an issue with Brave and works correctly in Chrome: brave/brave-browser#5618 |
Choose one: 🐛 bug report
When running a very basic Typescript application then go to
localhost:1234
in chrome, there is no syntax highlighting for.tsx
files.🎛 Configuration (.babelrc, package.json, cli command)
Command:
parcel ./src/index.html
tsconfig.json:
🤔 Expected Behavior
I expect that when I go to
http://localhost:1234
, go into the Sources tab and choose my tsx files, I should be able to see syntax highlighting for them.😯 Current Behavior
This is what I actually see
💁 Possible Solution
Server.js could be updated to use the correct mime type for tsx files. Info: https://stackoverflow.com/questions/53397337/in-chrome-devtools-in-all-my-tsx-source-files-syntax-highlighting-and-intellis
🔦 Context
I need to be able to debug using the chrome debugger, and not having syntax highlighting makes it difficult to do that.
💻 Code Sample
src/index.html
src/index.tsx
🌍 Your Environment
The text was updated successfully, but these errors were encountered: