-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Content hash output file names #1025
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1025 +/- ##
==========================================
- Coverage 89.27% 89.23% -0.05%
==========================================
Files 69 70 +1
Lines 3393 3631 +238
==========================================
+ Hits 3029 3240 +211
- Misses 364 391 +27
Continue to review full report at Codecov.
|
This is a really nice way to do it, we should make a chart of the implications of the different ways to import resources:
|
iframes do not currently retain the filename (they are hashed) since they aren't linked to directly. do you think we should keep the name? |
Hmm... Yeah, I think they should be. I would treat them as public resources that could be linked to elsewhere and not partials |
🎉 |
LOVING the new filenames. |
is there any way to opt out of hashing at all? I'm currently building a browser extension, and I have to explicitly list every js I'll need to load on the manifest.json file, so I can't have filenames changing all the time |
Includes the long-waited "Content hash output file names" parcel-bundler/parcel#1025
I'm doing the same thing as @rogeriochaves . It would be nice to be able to turn off the hashing so that tools, like Chrome Extensions, get static names that don't change so we can manage them better. |
@rogeriochaves @TheAlexPorter Please find or open an issue for this and mention it here. Thx! |
Hey guys,
Thanks |
@denis1stomin html files are not content hashed if they are the entry-point or required from html. So not sure why this file is content hashed? Feel free to open an issue, as you won't get much response on a merged PR |
I really need the support for disabling hashing for a specific path, for example I am struggling to use parcel with This way Currently I have to do this in a very ugly way: <a href="./images/img_0.png" />
<a href="./images/img_1.png" />
<a href="./images/img_2.png" />
<a href="./images/img_3.png" />
<a href="./images/img_4.png" />
<a href="./images/img_5.png" />
<a href="./images/img_6.png" />
<a href="./images/img_7.png" />
<a href="./images/img_8.png" />
<a href="./images/img_9.png" />
<a href="./images/img_10.png" />
<a href="./images/img_11.png" /> |
Would it be possible to hash the filenames when using a JS entrypoint? For example: {
"index.js": "dist/index.da39a3.js",
"test.js": "dist/test.ee5e6b.js"
} This feature would make working with a Maven/Java web project a lot easier (for me, atleast..) |
Hey everyone, I apologize if my question is not clear and concise. I am relatively new to the parceljs bundler and progressive web apps. I am currently trying to create an offline experience but I need to specify specific JS and CSS files that are needed for this experience in production. How do I, or how would I detect the exact filenames considering they are appended with hashes? This is needed for the cache file list for my service worker. Thanks! |
@LLe27 Some options:
|
Thanks, i'll give this a try! Worse case i'll just implement the Workbox library. EDIT: This method worked perfect! |
@devongovett We've tested this and the bundle files do get updated with new filename hashes when their contents change. However, the entry file does not get updated to point to the newly hashed files. |
This implements the strategy described in #872. In production mode, a hash of bundle content is appended to names of files that aren't entry points (e.g. HTML files, things linked to a
<a href>
, service workers, etc.). Unhashed files retain their original name, and path relative to the main entry point.In development mode, rather than using content hashes, the hash of the filename is used as before, so that filenames don't change during development. The hashes are necessary at all to avoid name collisions since the file structure is flattened. In addition, the filenames look more similar to the real production ones - the hashes just don't change.
It works by using a temporary filename (md5 of asset path) as references (which should be unique), and at the end, once file contents is known for all bundles, it replaces those temporary names with the real content-hashed names during packaging.
To do:
Please help me test! cc. @zeakd @songlipeng2003 @ssuman @Munter @benhutton @shanebo @leeching @gamebox @npup