File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -754,14 +754,20 @@ function resolveEnvironmentResolveOptions(
754754 // Backward compatibility
755755 isSsrTargetWebworkerEnvironment ?: boolean ,
756756) : ResolvedAllResolveOptions {
757+ let mainFields = resolve ?. mainFields
758+ mainFields ??=
759+ consumer === 'client' || isSsrTargetWebworkerEnvironment
760+ ? DEFAULT_MAIN_FIELDS
761+ : DEFAULT_MAIN_FIELDS . filter ( ( f ) => f !== 'browser' )
762+
757763 let conditions = resolve ?. conditions
758764 conditions ??=
759765 consumer === 'client' || isSsrTargetWebworkerEnvironment
760766 ? DEFAULT_CONDITIONS . filter ( ( c ) => c !== 'node' )
761767 : DEFAULT_CONDITIONS . filter ( ( c ) => c !== 'browser' )
762768
763769 const resolvedResolve : ResolvedAllResolveOptions = {
764- mainFields : resolve ?. mainFields ?? DEFAULT_MAIN_FIELDS ,
770+ mainFields,
765771 conditions,
766772 externalConditions :
767773 resolve ?. externalConditions ?? DEFAULT_EXTERNAL_CONDITIONS ,
You can’t perform that action at this time.
0 commit comments