question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable hashing of entry files and generation of manifest file

See original GitHub issue

🙋 Feature request

Enable hashing of entry files and generation of a manifest file via CLI/API option. This has already been suggested in https://github.com/parcel-bundler/parcel/issues/3279#issuecomment-516088162 but this issue serves a little more context as to why this is beneficial.

🤔 Expected Behavior

The resulting assets bundles should be hashed and a manifest file generated.

😯 Current Behavior

Entry files are not hashed.

💁 Possible Solution

The issue can be circumvented to some degree by the method outlined in https://github.com/parcel-bundler/parcel/issues/2611 but would like to see better out of the box support to open Parcel up to more types of projects.

🔦 Context

The inclusion of such a feature will enable a wider variety of projects to benefit from entry hashing. Parcel is currently very much focused on either very simple static stiles or the likes of SPA’s where it’s very probable you only have single index.html file, but in more traditional sites (PHP, .net, Ruby, etc) this may not be the case.

I’m thinking off PHP driven CMS’s and the like. In this situation, you have an index.php file that bootstraps the app and handles all the routing, your templates that reference your CSS and JS are off in another directory. Applying Parcel’s automatically dependency search isn’t practical but I think there is a middle ground where you can benefit from the majority of what Parcel has to offer, including entry file hashing.

My proposal is to allow entry files to be hashed and a manifest file created (it’s then up to the app to read this and include the hashed file names, there are many such libraries that do so for a host of backend languages).

Parcel is perfectly usable in these types of projects and a brilliant project that abstracts many issues with today’s build tools and lowers the barrier to entry. Entry hashing would be the icing on the cake.

💻 Examples

Multi Entry

build src/scripts/main.js src/styles/main.scss

Result

dist/scripts/main.hash.js dist/styles/main.hash.css

Single Entry with Imports

parcel build src/entry.js

// src/entry.js
import './scripts/main.js';
import './styles/main.scss';

Result

dist/entry.hash.js dist/entry.hash.css

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:18
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
kevincoxcommented, Feb 26, 2020

I think I understand what you want but it strikes me as not the correct solution.

I think by definition you can’t hash an entry because in my mind an “entry” is a place where someone will enter your application. But they can’t enter there if they don’t know the name.

This is why I am proposing the manifest route. In your case your application is the entry, however your entry needs to provide the path to the “non-entry” bundles that you depend on. I think this could also be considered something like “external entry” because parcel itself is not handling the entry, however it needs to export information about non-entries to your application so that you can reference them.

1reaction
jtojnarcommented, Dec 11, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Using a manifest to specify data files - Amazon Redshift
Use a manifest to ensure that the COPY command loads all of the required files, and only the required files, for a data...
Read more >
Manifests | Android Open Source Project
This setup enables multiple products with the same board to share the same vendor image (which provides common HALs) yet have different ODM ......
Read more >
"The OVF package is invalid and cannot be deployed" error ...
The following manifest file entry (line 1) is invalid: SHA256 ... because the vSphere Client does not support the SHA256 hashing algorithm, ...
Read more >
Mage.exe (Manifest Generation and Editing Tool)
Mage.exe also generates a hash for each file based on its size. ClickOnce uses these hashes to ensure that no one has tampered...
Read more >
Manifest Format
The manifest file consists of sections which are entries for various files in the archive. Many of the headers themselves are not covered...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found