Bundler Updates: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
mNo edit summary
 
Line 1: Line 1:
__NOTOC__
Discord uses a bundler to compress individual files into bigger, singular files known as chunks. This article documents major and minor changes to the bundler or its config over the years that have caused client mods to break.
Discord uses a bundler to compress individual files into bigger, singular files known as chunks. This article documents major and minor changes to the bundler or its config over the years that have caused client mods to break.


Line 17: Line 16:
On September 26, 2022, Discord switched from Babel to [https://swc.rs/ SWC]. This is considered the great cataclysmic event that killed off almost every client mod.
On September 26, 2022, Discord switched from Babel to [https://swc.rs/ SWC]. This is considered the great cataclysmic event that killed off almost every client mod.


React component display names were removed, making it harder for mods to find components.
React component display names were removed, making it harder for mods to find components. There were plans for Discord to find a way to keep display names for debugging purposes<ref>{{cite web|title=Ability to add displayName to all React components to prevent names from getting mangled|url=https://github.com/swc-project/swc/issues/5958}}</ref>, but they opted not to bother<ref>{{cite web|title="We might just stick with not having displayNames"|url=https://github.com/swc-project/swc/issues/5958#issuecomment-1258764673}}</ref>.
There were plans for Discord to find a way to keep display names for debugging purposes<ref>{{cite web|title=Ability to add displayName to all React components to prevent names from getting mangled|url=https://github.com/swc-project/swc/issues/5958}}</ref>, but they opted not to bother<ref>{{cite web|title="We might just stick with not having displayNames"|url=https://github.com/swc-project/swc/issues/5958#issuecomment-1258764673}}</ref>.


Module export names were mangled. Finding specific functions without searching for the function's code was even harder. There were specific patterns, such as <code>default</code> becoming <code>Z</code> or <code>ZP</code>.
Module export names were mangled. Finding specific functions without searching for the function's code was even harder. There were specific patterns, such as <code>default</code> becoming <code>Z</code> or <code>ZP</code>.
Line 27: Line 25:
Module export names return. This caused parts of mods broken by SWC to work in some capacity, excluding React component display names.
Module export names return. This caused parts of mods broken by SWC to work in some capacity, excluding React component display names.


Every theme was now broken as Rspack's unique class name plugin uses <code>_</code> or <code>__</code> as the separator between the name and the random string.
Every theme was now broken as Rspack's unique class name plugin uses <code>_</code> or <code>__</code> as the separator between the name and the random string. In addition, every stylesheet was loaded in the body instead of the head, forcing client mods to put their stylesheets in <code>document.documentElement</code> for the highest priority.
In addition, every stylesheet was loaded in the body instead of the head, forcing client mods to put their stylesheets in <code>document.documentElement</code> for the highest priority.


More than 100 chunk files are initially loaded instead of 4.
More than 100 chunk files are initially loaded instead of 4.
13

edits

Navigation menu