string[]
>= 1.5.9
Controls the priority of fields in a package.json used to locate a package's entry file. It is the ordered list of package.json fields Rspack will try when resolving an npm package's entry point.
resolve.mainFields
is provided by Rspack, see Rspack - resolve.mainFields to learn more.
'web'
, 'web-worker'
, or not specified, the default value is ["browser", "module", "main"]
.'node'
, the default value is ["module", "main"]
.The value of resolve.mainFields
overrides the default value of Rsbuild:
Configure different mainFields
for different environments: