How to generate output file with hash in name
Thanks for your great work
I'm building a library with parcel which can run in browser. It has an entry file index.js
written in es6
I build it with parcel build index.js
and want something like index.hash.js
but always get index.js
How can I get that index.hash.js
file ?
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.8.1|
| Node |6.14.2|
| npm/Yarn |1.6.0|
| Operating System |Ubuntu 16.04|
This already happens by default when building for production. However, we do not hash entry points because they might be linked to directly. If you point parcel at your HTML file instead of a JS entry point, it will automatically hash your linked JS files.
@devongovett thanks for your answer
When I build using parcel build index.html
, it generates index.html
and src.hash.js
. I want the .js file to be index.hash.js
. How can I get it
Hi,
@devongovett I have the following szenario:
I use parcel to bundle the client files for an ASP.NET core MVC site. I run parcel with
parcel watch src/*.ts src/*.less --out-dir ../wwwroot/dist
in my .cshtml I reference the files like so:
<script type="text/javascript" asp-src-include="~/dist/site.*.js"></script>
The hash in the name would be nice to have to overcome some caching problems while deployment to production.
I think a switch like --force-hash
or --hash-files
would be a good option to enable a scenario like this.
I am quite new to parcel, maybe I got something wrong here, so please give me a push in the rigt direction.
Thanks,
KirK
Most helpful comment
Hi,
@devongovett I have the following szenario:
I use parcel to bundle the client files for an ASP.NET core MVC site. I run parcel with
in my .cshtml I reference the files like so:
The hash in the name would be nice to have to overcome some caching problems while deployment to production.
I think a switch like
--force-hash
or--hash-files
would be a good option to enable a scenario like this.I am quite new to parcel, maybe I got something wrong here, so please give me a push in the rigt direction.
Thanks,
KirK