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
When bundling a CommonJS library that exports variables, the directory name of the project's root is used, rather than the package name or some other generic name. This doesn't happen with ESM modules. In the following example, note that require_temp is the name of a variable, because the folder name of the project happened to be temp.
This is problematic because it makes it impossible to create deterministic reproducible builds since there can be no guarantee about the directory structure above the project on a given machine. Even automated build environments may have something like a hash or ID in the directory name.
It is worth noting, I am very intentionally not minifying/obfuscating anything. The bundle should be as human readable as possible and I explicitly do not wish to just mangle all of the names away. I also am fine with directory structure/filenames within the project to have an impact on the names that are chosen, as those are part of version control. I merely want the build output to not include the parent directory name.
The text was updated successfully, but these errors were encountered:
When bundling a CommonJS library that exports variables, the directory name of the project's root is used, rather than the package name or some other generic name. This doesn't happen with ESM modules. In the following example, note that
require_temp
is the name of a variable, because the folder name of the project happened to betemp
.This is problematic because it makes it impossible to create deterministic reproducible builds since there can be no guarantee about the directory structure above the project on a given machine. Even automated build environments may have something like a hash or ID in the directory name.
package.json
index.js
Bundle Command:
Bundle Output:
It is worth noting, I am very intentionally not minifying/obfuscating anything. The bundle should be as human readable as possible and I explicitly do not wish to just mangle all of the names away. I also am fine with directory structure/filenames within the project to have an impact on the names that are chosen, as those are part of version control. I merely want the build output to not include the parent directory name.
The text was updated successfully, but these errors were encountered: