microsoft / microsoft/TypeScript-Sublime-Plugin

Importing modules with require doesn't work with plugins

Offen
#190 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

TypeScript/TS Services Issue
Vorherrschende Sprache
JavaScript
Sterne
1.7k
Forks
236
Ø Merge
21 T. 13 Std.
Gemergte PRs (30 T.)
1

Beschreibung

Using custom requirejs plugins is not supported. This results in an error, even if the './MyModule' path is valid:

import MyModule = require('someplugin!./MyModule');

Obviously tsc can't know what the plugin does so one may argue reporting an error is the right thing to do, however some plugins preprocess (or load using alternative methods) resources matching the local file system hierarchy (in my case I use a plugin which uses an alternative way to load code).

Unless there are better ideas I suggest to skip the plugin prefix (someplugin!) and validate the local path, as usual. If there was a compiler flag (either a command line option or a source-code-level magic statement) controlling this behaviour that would surely make everyone happy.

For completeness: requiring in the class body is not a solution as such statements don't validate the path.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Das Issue nennt keine Quelldatei, keinen Test und keinen Einstiegspunkt. Beginne damit, den Fehler für import MyModule = require('someplugin!./MyModule') zu reproduzieren, und verfolge die bestehende Validierung von Modulpfaden; abgeschlossen ist die Aufgabe, wenn das vereinbarte Verhalten für pluginpräfixierte lokale Pfade implementiert und durch Tests abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, typescript
Bereich
devtools, tooling
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.