loader-utils icon indicating copy to clipboard operation
loader-utils copied to clipboard

Feature: add compiler output options support for hash

Open aarefiev opened this issue 7 years ago • 5 comments

Hi!

It will be cool if loader will support output options of webpack, especially options for hash like as hashDigestLength. It is very useful if I should have the same length for all files after compilation. But now, I should set the same setting for all loaders that using loader-utils for processing files in core.

According to my opinion I should stay here proof based on webpack documentation (https://webpack.js.org/configuration/output/#output-filename):

The lengths of [hash] and [chunkhash] can be specified using [hash:16] (defaults to 20). Alternatively, specify output.hashDigestLength to configure the length globally.

The main word is globally, I expect that global scope is including loaders too.

aarefiev avatar Dec 21 '18 11:12 aarefiev

Has there been any progress on this? Anything needed? It would be nice to support hashDigestLength for consistency when using loaders like file-loader. I noticed the PR (#120) has been left open.

jahed avatar Mar 22 '20 00:03 jahed

Should be solved on webpack side

alexander-akait avatar Mar 23 '20 09:03 alexander-akait

No, it is won't fix, we can't calculate hash of build on loader side

alexander-akait avatar Mar 25 '20 11:03 alexander-akait

@rightaway it is won't fix, no need issues, you can use output: 'dist/[hash]' if you need unique directory on build

alexander-akait avatar Mar 25 '20 11:03 alexander-akait

@evilebottnawi I'm using [contenthash] for my project outputs so it would be nice if loader-utils supported output.hashDigestLength for that like Webpack's outputs do.

jahed avatar Mar 25 '20 16:03 jahed