microsoft / microsoft/TypeScript
Write typescript as modules, but output js without modules
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
Search Terms
Searched the whole internet for anything like it, only webpack and browserify related 'solutions' are proposed.
Suggestion
Split module options in tsconfig so typescript modules could be set separately from output target modules.
Use Cases
Our usecase:
- We have a huge codebase, and we want to slowly move to typescript.
- We have a sophisticated build system that we don't want to change - we want typescript to transpile to js and to take js and continue to use it as we were.
- We don't need nor want to use modules in js. We never used modules - we have our system of imports, minification,
versioning, caching, etc. - The only reason why we need to use modules in typescript is tsc incremental watch build. With no modules, it builds complete codebase on each change. We want to build only file changed and dependent files.
So currently we have two bad options - don't use modules (unacceptably slow build time) or use modules (get the output that we don't want). Currently we 'mitigate' the issue by removing parts of js tsc has output (removing stuff we recognize as related to exports and require), but that's just terrible.
Even worse, even if we were to use modules, require / exports are inlined even in output we want to inline to index.html as critical JS...
Examples
I guess I explained it all above.
Checklist
My suggestion meets these guidelines:
- [ * ] 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, etc.)
- [ * ] This feature would agree with the rest of TypeScript's Design Goals.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der Prüfung der tsconfig-Moduloptionen und des im Issue beschriebenen inkrementellen Watch-Build-Verhaltens. Ermitteln Sie, wie separate Einstellungen für Quellmodule und ausgegebene Module miteinander interagieren sollten, und überprüfen Sie anschließend, dass TypeScript nicht-modulares JavaScript ausgeben kann, während inkrementelle modulbasierte Builds beibehalten werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- build-system, compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100