Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chunk name #49

Closed
audiolion opened this issue Apr 4, 2017 · 5 comments
Closed

Chunk name #49

audiolion opened this issue Apr 4, 2017 · 5 comments

Comments

@audiolion
Copy link

Hello,

Is there a way to attach a chunk name to this output? Other plugins I use work on the chunks that were output and this plugin doesn't attach any chunk name.

This may not be possible (e.g. this plugin is taking the chunks and compressing them and outputting them), but it would be nice if that were the case that it would delete the old files (this function is already there) and the new files would have the same chunk name as the uncompressed version

@michael-ciniawsky
Copy link
Member

@audiolion Could you provide a small example (code) for that please 😛

@joshwiens joshwiens removed the question label May 1, 2017
@sibelius
Copy link

sibelius commented May 5, 2017

you can use [chunkhash] in your bundle names

this package will only add .gz to it

example

new CompressionPlugin({
      asset: '[path].gz[query]',
      algorithm: 'gzip',
      test: /\.(js|html)$/,
      threshold: 10240,
      minRatio: 0.8,
    }),

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented May 5, 2017

@audiolion See @sibelius's post
@sibelius Thx 😛

@michael-ciniawsky michael-ciniawsky removed their assignment May 5, 2017
@gareth-robinson
Copy link

Given this is a year old perhaps the answer above was the right one and I shouldn't comment on old closed tickets... or put words into anyone elses mouth... but anyway I'm also wondering about this plugin and chunk names.

If you are creating a plugin you can listen for events and get a 'compilation' object (as you do yourselves, here: https://github.com/webpack-contrib/compression-webpack-plugin/blob/master/src/index.js#L71). If I run a plugin after the compression plugin this compilation object only contains the 'original' chunk, there is not an additional one created for the compressed output. That is, if I use compilation.getStats().toJSON() I see it can contain

  ...,
  assetsByChunkName: 
   { 'my-stuff': 'my-stuff.js' },
  assets: 
   [ { name: 'my-stuff.js',
       size: 170482,
       etc... },
     { name: 'my-stuff.js.gz',
       size: 35944,
       etc... } ],
  ...

that is, there is no additional chunk name for the compressed asset. Can/should there be?

@xitter
Copy link

xitter commented Aug 28, 2020

Added more descriptive issue: #185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants