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
foo/
package.json {sideEffects: false}
real-bar.js
bar/
package.json {main: '../real-bar.js', has no defined sideEffects property}
Intuitively, it seems that real-bar.js's sideEffects value should be false, not undefined, as it's a child of the foo directory, which has a package.json defining "sideEffects": false.
However, when import 'foo/bar' is currently resolved, it resolves correctly to foo/real-bar.js, but the associated package.json for the asset is foo/bar/package.json, not foo/package.json. This makes foo/real-bar.js's sideEffects value undefined when it's required as import 'foo/bar', but it's false when it's required as import 'foo/real-bar.js' (or import './real-bar.js' or similar).
We should consider conditionally re-resolving an asset's package.json when the initially resolved package.json points to a module that would otherwise resolve a different package.json.
Consider the following tree:
Intuitively, it seems that real-bar.js's sideEffects value should be
false
, notundefined
, as it's a child of the foo directory, which has a package.json defining"sideEffects": false
.However, when
import 'foo/bar'
is currently resolved, it resolves correctly tofoo/real-bar.js
, but the associated package.json for the asset isfoo/bar/package.json
, notfoo/package.json
. This makesfoo/real-bar.js
's sideEffects valueundefined
when it's required asimport 'foo/bar'
, but it'sfalse
when it's required asimport 'foo/real-bar.js'
(orimport './real-bar.js'
or similar).We should consider conditionally re-resolving an asset's package.json when the initially resolved package.json points to a module that would otherwise resolve a different package.json.
cc @mischnic @devongovett @thebriando
The text was updated successfully, but these errors were encountered: