Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS hash changes when src folder moved #3416

Closed
jakearchibald opened this issue Mar 2, 2020 · 8 comments · Fixed by #4543 or #4549
Closed

JS hash changes when src folder moved #3416

jakearchibald opened this issue Mar 2, 2020 · 8 comments · Fixed by #4543 or #4549

Comments

@jakearchibald
Copy link
Contributor

Expected Behavior

The two src folders have identical contents, their output filenames should not differ between builds.

Actual Behavior

All three files change hash.

#2839 may be related.

@lukastaegert
Copy link
Member

Interesting point. My feeling is that implementing the improved hashing I outlined in #2872 (comment) might solve this as well, definitely worth keeping as a test case for a new algorithm.

@jakub-g
Copy link

jakub-g commented Feb 1, 2021

I don't know if related, but I was hitting the same kind of issue with webpack, and the problem was that a loader (plugin) transforming an import request used absolute disk path of the file as an internal import identifier (relying on __dirname, path.resolve() and other similar things can lead to this), leading to non-deterministic input (when building inside a different folder for example).

@myarcane
Copy link

myarcane commented Feb 2, 2021

It is worth mentioning that the bug only exists with code splitting configurations when input takes an array of files :

 input: [`src${num}/index.js`, `src${num}/profile.js`]

Obviously if rollup builds each of these files separately :

// rolllup.config.js
export default ["index.js", "profile.js"].reduce((config, file) => {
 [1, 2].forEach((num) => {
   config.push({
     input: `src${num}/${file}`,
     output: {
       entryFileNames: "[name]-[hash].js",
       dir: "build/" + num,
       format: "esm",
     },
   });
 });
 return config;
}, []);

the hash names remain the same for each source folder.

Maybe a "code splitting" label should be added ?

@lukastaegert
Copy link
Member

Fix finally at #4543

1 similar comment
@lukastaegert
Copy link
Member

Fix finally at #4543

@rollup-bot
Copy link
Collaborator

This issue has been resolved via #4543 as part of rollup@3.0.0-7. Note that this is a pre-release, so to test it, you need to install Rollup via npm install rollup@3.0.0-7 or npm install rollup@beta. It will likely become part of a regular release later.

@rollup-bot
Copy link
Collaborator

This issue has been resolved via #4543 as part of rollup@3.0.0-8. Note that this is a pre-release, so to test it, you need to install Rollup via npm install rollup@3.0.0-8 or npm install rollup@beta. It will likely become part of a regular release later.

@rollup-bot
Copy link
Collaborator

This issue has been resolved via #4543 as part of rollup@3.0.0. You can test it via npm install rollup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants