feature request: support conditional exports (package.json `exports` field)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- javascript
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from postcss/postcss-import
-
Subpath imports Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
postcss/postcss-import#573 · 2 comments ·
-
Dependency Dashboard Opendeps
Difficulty 1/5 Under an hour Newbie friendliness 15/100
postcss/postcss-import#470 ·
All issues in postcss/postcss-import
Similar issues
-
bot:ai-assisted component:compact-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
midnightntwrk/midnight-sdk#403 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
DavidAnson/markdownlint-cli2#940 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
githubnext/gh-aw-workshop#3692 ·
-
agent/guide documentation hive/hosted-available-lke648397-260827-5n31
Difficulty 2/5 1-3 hours Newbie friendliness 90/100