Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

feature request: support conditional exports (package.json `exports` field)

Aperta
#492 11 commenti 21 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
javascript
Ambito
frontend, tooling

Direzione di ricerca

Start by tracing how postcss-import resolves package imports and the existing style field, then compare that behavior with the conditional exports examples in the issue. Add support for the requested exports paths with exports taking precedence over style, and verify both package styles and conditional exports remain legible to postcss-import.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

discussion enhancement

Love the style support, but would really helpful for conditional exports to also be legible to postcss-import:

{
  ...,
  "exports": {
    ".": "./dist/index.js",
    "./*": "./dist/lib/*/index.js",
    "./styles": "./dist/styles/index.css",
    "./styles/*": "./dist/styles/*/index.css",
    "./package.json": "./package.json"
  },
  ...,
}

The main reason I suggest this is because I cannot specify an @import "my-package/styles" statement in a way that is supported by both esbuild (supports standardized package.json exports, but not nonstandard style) and postcss-import (where situation is reversed). my-package/styles is the only thing that works for esbuild, but my-package is the only thing that works for postcss-import.

I would recommend following the Node doctrine of "if exports exists, it overrides anything else" (i.e. style field). Also thank you for maintaining this project, it is a core part of modern development workflows IMO, only reason I suggest the enhancement.

Lingua principale
JavaScript
Stelle
1.4k
Fork
118
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di postcss/postcss-import

Tutte le issue di postcss/postcss-import

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.