You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently build all files in each package into two dist files: an ESM version and a CommonJS version. This has the advantage that it prevents users from accessing internal functions that we didn't mean to expose (e.g. import 'foo/dist/private.js'), but has the disadvantage that tree shaking is less effective. This is because the sideEffects: false option in package.json only applies on the file level, and we bundle all files into one. See #1378 for some discussion about this.
We should consider splitting these out and not bundling all files together. The exports field in package.json could potentially be used to prevent unintended access to private modules, but only if actually implemented by tools (e.g. Parcel doesn't currently support it). It's also possible that we could bundle some packages and not others, or do some smarter bundling strategy where modules that are only imported from one other file are bundled together, but publicly accessible files are separate entry points. We could also allow accessing certain sub-paths via the exports field, e.g. import '@react-aria/interactions/usePress' and treat these as entry points into the graph.
The text was updated successfully, but these errors were encountered:
We currently build all files in each package into two dist files: an ESM version and a CommonJS version. This has the advantage that it prevents users from accessing internal functions that we didn't mean to expose (e.g.
import 'foo/dist/private.js'
), but has the disadvantage that tree shaking is less effective. This is because thesideEffects: false
option in package.json only applies on the file level, and we bundle all files into one. See #1378 for some discussion about this.We should consider splitting these out and not bundling all files together. The exports field in package.json could potentially be used to prevent unintended access to private modules, but only if actually implemented by tools (e.g. Parcel doesn't currently support it). It's also possible that we could bundle some packages and not others, or do some smarter bundling strategy where modules that are only imported from one other file are bundled together, but publicly accessible files are separate entry points. We could also allow accessing certain sub-paths via the
exports
field, e.g.import '@react-aria/interactions/usePress'
and treat these as entry points into the graph.The text was updated successfully, but these errors were encountered: