The answer to this puzzle can be found in the customInterpolateName loader option. With webpack@v3.4.1 below was my end result for hyphen removal.
It was a key tidbit:
plugins: [ // ... other plugins ... new webpack.LoaderOptionsPlugin({ options: { customInterpolateName: (loaderContext) => { return loaderContext.replace(/-/g, ''); } } }) ]
Here is a more complete example to give some context (note: .css was added to the font names intentionally as a workaround for another restriction of the web resource name in Dynamics CRM):
module.exports = { // ... other config ... module: { loaders: [ // ... other loaders ... { test: /\.(ttf|eot|woff|woff2)$/, loader: `url-loader?limit=${ASSETS_LIMIT}&name=fonts/[name].[ext].css` } ] }, plugins: [ // ... other plugins ... new webpack.LoaderOptionsPlugin({ options: { customInterpolateName: (loaderContext) => { return loaderContext.replace(/-/g, ''); } } }) ] };
source share