microsoft / microsoft/TypeScript
Standard package.json key for .ts files
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
A common TypeScript module structure looks like this:
src/index.ts
dist/index.js
dist/index.d.ts
and a package.json that looks like this:
"main": "dist/index.js",
"types": "dist/index.d.ts",
There's a convention to use the package.json key jsnext:main to point to a variant of main that uses ES2015 module syntax. Can we develop a similar convention to point at .ts files, e.g. typescript:main?
Consider a TypeScript project that is sharded across many microlibraries (e.g. my-project-core, my-project-thing-plugin, my-project-other-thing-plugin). I'd like to be able to configure my bundler to import from src/*.ts files for any module whose name starts with my-project. Otherwise, it will be looking in dist/*.js and I'll have to rebuild the plugins any time I make changes in them.
Of course, I could use jsnext:main for this purpose now, but any consumers who aren't using TypeScript would get syntax errors for any files that contained TS-specific syntax like types. Similarly, I could make up my own package.json key and configure my bundler to look there first, but it behooves the community to have a convention here. That will allow bundlers like Webpack, Browserify, Rollup, and Pundle to look in the right place by default.
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
Überprüfe die im Issue gezeigten package.json-Einträge, insbesondere main, types und jsnext:main, und vergleiche anschließend, wie Webpack und Rollup Paket-Einstiegspunkte auflösen. Untersuche, ob eine TypeScript-spezifische Konvention Unterstützung durch die Community oder Bundler hat; als abgeschlossen gilt die Recherche, wenn das Design und der Einführungsweg der Konvention eindeutig feststehen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rollup, typescript, webpack
- Bereich
- build-system, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100