microsoft / microsoft/TypeScript
Provide option to not include `sourceMappingURL` in the generated `.js` file when `sourceMap` is `true`
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.4k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 117
Description
🔍 Search Terms
- sourceMappingURL
- sourceMap
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
There should be a compilerOption to disable inclusion of sourceMappingURL in the generated .js file when sourceMap is true.
📃 Motivating Example
When sourceMap is true in tsconfig.json, TypeScript compiler generates .map file together with .js file and also include sourceMappingURL in .js file.
The inclusion of sourceMappingURL in .js file is one way of linking generated code with sourcemap.
Another way is to use SourceMap header.
Right now, to make use of SourceMap header without including sourceMappingURL in .js file, I have to:
- set
sourceMaptotrue - run
npx tsc - set
sourceMaptofalse - run
npx tsconce again.
There should provide a compilerOption to disable inclusion of sourceMappingURL in the generated .js file.
💻 Use Cases
-
What do you want to use this for?
I want to use this to use SourceMap header without getting warning in browser. The benefit of using SourceMap header is that the linking of generated file to map file can be controlled by the server without regenerating.jsfile. -
What shortcomings exist with current approaches?
sourceMappingURLis included in.jsfile. -
What workarounds are you using in the meantime?
- set
sourceMaptotrue - run
npx tsc - set
sourceMaptofalse - run
npx tsconce again.
- set
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
L’issue ne nomme aucun fichier, test ni point d’entrée du compilateur. Commencez par suivre la façon dont l’option du compilateur sourceMap contrôle l’émission des fichiers .map et du commentaire sourceMappingURL. Le travail est terminé lorsqu’une option du compilateur documentée peut supprimer ce commentaire tout en continuant à émettre les source maps, avec une couverture des comportements activé et désactivé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- javascript, typescript
- Domaine
- compilers
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 30/100