core icon indicating copy to clipboard operation
core copied to clipboard

Modify build process to disable code splitting

Open mcmire opened this issue 1 year ago • 4 comments

Explanation

The code splitting feature in tsup breaks up source code into logical modules so that if a module is not being used it can be removed by a build tool that supports tree shaking.

However, the modules that tsup creates do not necessary match the files in the original source code, and tsup gives them a random name. This makes it frustrating for developers on a client team who are debugging a core package by inspecting the compiled version, because it is impossible to tell what a chunk file contains without first opening it up.

This commit thus configures tsup to disable the code splitting feature.

References

Fixes #4333.

Testing

  • Run yarn build.
  • Open up the dist directory for a package such as packages/assets-controllers.
  • You shouldn't see any files named chunk-XXXX.js or chunk-XXXX.mjs.

Changelog

(Updated in PR.)

Checklist

  • [x] I've updated the test suite for new or updated code as appropriate
  • [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • [x] I've highlighted breaking changes using the "BREAKING" category above as appropriate

mcmire avatar May 28 '24 17:05 mcmire

@metamaskbot publish-previews

mcmire avatar Jun 27 '24 16:06 mcmire

@metamaskbot publish-preview

mcmire avatar Jun 27 '24 16:06 mcmire

@metamaskbot publish-previews

mcmire avatar Jun 27 '24 16:06 mcmire

The repo is in a state of limbo currently because of a failed release. Once that gets resolved then I'll try creating preview builds again.

mcmire avatar Jun 27 '24 16:06 mcmire

I am going to close this PR, as we need code splitting for Snaps. ts-bridge is close to supporting monorepos anyway.

mcmire avatar Jul 23 '24 21:07 mcmire