turbopack to support custom condition names for resolving package exports #78912
Replies: 2 comments 1 reply
-
I'm hitting this issue again in a different place. Some more detail about my use case: Problem statementI have a monorepo like:
When building Therefore, within this monorepo, when writing My attempted solutionThe modern way to do this seems to be:
{
"name": "my-components",
"type": "module",
"exports": {
"./*": {
"my-source": [
"./src/*/index.ts",
"./src/*/index.tsx",
"./src/*.tsx",
"./src/*.ts"
],
"typescript": ["./dist/*/index.d.ts", "./dist/*.d.ts"],
"default": ["./dist/*/index.js", "./dist/*.js"]
}
},
} Here, I've defined a custom condition name Then, I just need to tell all the bundlers within the monorepo to use this custom condition name I'd be also interested to know if there's a better way to solve my problem. |
Beta Was this translation helpful? Give feedback.
-
# |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Support of custom condition names, to tell turbopack which conditions to apply when resolving package exports.
Non-Goals
N/A
Background
See node's documentation for background on package exports, and conditions.
Custom condition names can be passed into various other tools:
config.resolve.conditionNames
compilerOptions.customConditions
config.resolver.unstable_conditionNames
Proposal
I feel like turbopack could emulate webpack's config interface, e.g. add a config option
resolveConditionNames
which accepts an array of conditions, defaulting to['browser', 'require', 'import']
or something like that.Beta Was this translation helpful? Give feedback.
All reactions