microsoft / microsoft/TypeScript
Write typescript as modules, but output js without modules
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando le opzioni dei moduli di tsconfig e il comportamento della compilazione incrementale in modalità watch descritto nell’issue. Determina come dovrebbero interagire le impostazioni separate del modulo sorgente e del modulo emesso, quindi verifica che TypeScript possa emettere JavaScript non modulare mantenendo le compilazioni incrementali basate sui moduli.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- build-system, compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100