Parcel: Is there a way to turn off the md5 on built assets?

Created on 18 Jul 2018  ยท  9Comments  ยท  Source: parcel-bundler/parcel

โ” Question

Is there a way to turn off the MD5 that is put on the filenames?

๐Ÿ”ฆ Context

I deploy a solution to an AWS S3 bucket which is then served by Cloud Front. Problem I have been running into is every time I deploy I am filling up my bucket with new md5 files rather than just replacing them. I would like to be able to turn off the autogenerated hash so I can just replace the files on S3 upload.

Related Issues

717

Question

All 9 comments

It is possible in the API using contentHash:false in the options object.

Currently no cli flag sets this option however

It would be nice to have this in the docs here: https://parceljs.org/api.html
So I added the change: https://github.com/parcel-bundler/website/pull/213

Actually, That doesn't do what I was expecting. Either way there is a file hash included in the filename.

Well there is but it doesn't change

Closing since question was answered. Thanks @DeMoorJasper

Hm... what if in my use-case I need no just replace new build assets (without md5 on them)?
Is there a way to cut md5 at the end of build assets?

Fixed my issue!
And now have such a bundler:

const Bundler = require('parcel-bundler');

const entryFiles = ['./src/crm.pcss', './src/crm.js'];

// Bundler options
const options = {
  minify: true,
};

(async function() {
  const bundler = new Bundler(entryFiles, options);
  bundler.serve();
})();

P.S. How to make a bundler? Read this: parceljs.org/api.html
I run it like: node parcel-bundler.js

Hm... what if in my use-case I need no just replace new build assets (without md5 on them)?

I don't quite understand what you want to say here. But with --no-content-hash the hash at the end is stable across multiple (if that's what you meant by "replace")

Hm... what if in my use-case I need no just replace new build assets (without md5 on them)?

I don't quite understand what you want to say here. But with --no-content-hash the hash at the end is stable across multiple (if that's what you meant by "replace")

That option doesn't work

image

Versions

image

Was this page helpful?
0 / 5 - 0 ratings