levp / wrapper-webpack-plugin

A webpack plugin that wraps output files (chunks) with custom text or code.
91 stars 37 forks source link

Code gets removed even with `afterOptimizations` to `true` #17

Open ChocolateLoverRaj opened 3 years ago

ChocolateLoverRaj commented 3 years ago

I'm using the plugin like this:

new WrapperPlugin({
 header: (fileName, { hash }) => {
    return fileName === 'serviceWorker.bundle.js' ? `/* hash: ${hash} */` : ''
  },
  afterOptimizations: true
})

When running in development mode, the comment is there, but when running in production mode, the comment is not there.

I think this might be because of #11.