Avoid bundling in JavaScript from nested node_modules.
Review Request #13721 — Created April 8, 2024 and submitted — Latest diff uploaded
When symlinking the Ink tree for development, I began to hit a confusing
issue with Spina class setup. It turns out that we were getting two
copies of Spina, two copies of Backbone, and two copies of Underscore in
our 3rdparty.js build.The reason for this is that the Ink tree had its own
node_modules
, and
Rollup prioritized pulling Ink's dependencies from there. That gave us
unique copies for Ink that were namespaced internally separately from
Review Board's. That also meant that Spina state was then kept in two
places, causing all manner of problems.The reason this was happening was that Rollup.js defaults to considering
any and allnode_modules
paths, by way of themoduleDirectories
setting. This differs frommodulePaths
, which is an explicit set of
paths (absolute or relative to the source tree).Since we know we only want the top-level one, we can set
moduleDirectories
to an empty list, ensuring that nested
node_modules
are no longer considered when bundling.
Verified that this solved my duplicate module issue.