Nwb: How to disable filename hashing in build

Created on 31 Jan 2017  路  6Comments  路  Source: insin/nwb

Is there a way to disable the built-in hashing of filenames? I have a use-case that requires it. I've tried putting "options: { name: '[name].[ext]'}" in loader rules in my nwb.config.js but haven't found a config that works.

Thanks

This issue is a:

  • [ ] Bug report
  • [ ] Feature request
  • [x ] Question / support request
  • [ ] Other

support

Most helpful comment

My built assets are tracked in a separate cvs-like source control system and it would be painful to manage them with changing filenames. I suspect it's a fairly unique use-case.

All 6 comments

Is this just for static files which are being imported to be handled by Webpack?

This should configure all the default url-loaders appropriately (using the rule ids from here):

module.exports = {
  webpack: {
    rules: {
      graphics: {name: '[name].[ext]'},
      svg: {name: '[name].[ext]'},
      jpeg: {name: '[name].[ext]'},
      fonts: {name: '[name].[ext]'},
      video: {name: '[name].[ext]'},
      audio: {name: '[name].[ext]'}
    }
  }
}

I could also add additional config to allow you to configure the default url loader settings, which would take care of all of these in one go.

Thanks. This helps. Any way to do the same for js and css?

extractText and extra should get you the rest of the way.

module.exports = {
  webpack: {
    extractText: {
      filename: '[name].css'
    },
    extra: {
      output: {
        filename: '[name].js',
        chunkFilename: '[name].js'
      }
    }
  }
}

Much appreciated!

What's the use-case for needing un-hashed filenames, if you can tell me?

This is potentially something which could be controlled by adding new higher-level convenience config if it would be generally useful, e.g.

module.exports = {
  webpack: {
    hashFilenames: false
  }
}

My built assets are tracked in a separate cvs-like source control system and it would be painful to manage them with changing filenames. I suspect it's a fairly unique use-case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BurntCaramel picture BurntCaramel  路  4Comments

ivanasetiawan picture ivanasetiawan  路  5Comments

feelic picture feelic  路  5Comments

sergiop picture sergiop  路  5Comments

tlindsay picture tlindsay  路  3Comments