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.

--no-content-hash or something else ? (don't touch the assets please)

See original GitHub issue

❔ Question

Hello!

I’ve searched all along but I don’t see anything that really answer the question (or the problem).

I want to take benefit of the --no-content-hash but the console say unknown option –no-content-hash’` and I tried with the ‘build’ command and it make the (nearly) same output, files are still hashed.

I use the plugin parcel-plugin-asset-copier

Here are my full commands: Dev: "dev:local": "cross-env parcel html/index-dev.html --no-autoinstall --port 8081 -d dist/dev/ --cert ssl/localhost.crt --key ssl/localhost.key", Prod: "build": "cross-env parcel build --no-content-hash html/index-dev.html -d dist/prod/"

So far so good (without the --no-content-hash) but the problem is that every single assets used by html/css is hashed and throw in the dev/ folder, while I also have every assets in my /assets/ sub repos.

So I have fonts, icons, etc. And also got them in /assets/.

Maybe that something we will be able to do in Parcel 2? (I’m on LTS projects only…)

🔦 Context

I would like that parcel do not modify resources that way I can keep them in the folder. It’s not “clean” that way and we have several builds on the server using the same resources. Also, each templates (and JS) are using images, so I can’t just “delete” my assets folders, as it is now, parcel put some images in the dist/, and I have duplicates in assets/ and both are used…

🌍 Your Environment

Last parcel 1.12.4 parcel plugin asset copier: 1.0.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
devongovettcommented, Oct 12, 2020

You can solve this with a custom namer plugin: https://v2.parceljs.org/plugin-system/namer#content. This gives you complete control over the file naming of all bundles produced by parcel.

0reactions
BasicallyMecommented, Aug 17, 2022

This has been a headache for almost 5 days. I’m trying to make a carousel of images using plain JS, but every time I run the code to change the image, Voila - the image doesn’t load. So I tried to console.log to check the URL of the original image (which is present locally in the assets folder), referenced in the index.html file, and there I see this hash being added to the name of the image file. Now I’m not sure whether Parcel adds the hash to the URL, after I change it in JS, because no matter how many times I check the image doesn’t get reference and it just doesn’t load.

<div class="avatar-container"> <img src="assets/avatar/avatar-1.jpg" alt="Picture of a person"> </div>

const setImage = (avatar, image) => { console.log('test🐸'); const avatarImage = avatarContainer.querySelector('img'); avatarImage.src = avatar; // console.log(avatarImage); }

Here avatar is the relative path passed to the function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack 4 to 5: custom plugin: replacing compilation.assets ...
BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation. Do changes to assets earlier, e. g. in ...
Read more >
What is a memo, destination tag, and message, and how do I ...
Go to the wallet of the crypto that you want to send with a memo or destination tag, then tap Send. Algorand is...
Read more >
How to Find and Fix Mixed Content Warnings on HTTPS Sites
Simply supporting HTTPS isn't always enough — you also need to know how to identify and fix mixed content errors.
Read more >
How To Create An ENTIRE NFT Collection (10000+) & MINT ...
Use NFTPort to easily mint your NFTs and much more ! https://nftport.xyzCheck out the collection I made: ▷ https://codecats.xyz▷ ...
Read more >
Yes, Your NFTs Can Go Missing—Here's What You ... - Decrypt
Yes, your NFTs can go missing. NFTs don't really permanently live on a blockchain. That can be a huge problem when it comes...
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