I'm upgrading to Webpack 4 from Webpack 3. In index.html I have the following:
<link rel="manifest" href="<%= require('!file-loader?name=[path][name]-[hash:6].[ext]!static/manifest') %>">
However it had stopped working after the upgrade. The compilation fails saying:
Module parse failed: Unexpected token m in JSON at position 0 while parsing near 'module.exports = __w...'
Seems like Webpack is trying to parse the json file (possibly twice) which is not what I need (the documentation mentions json files are now being parsed by default). Not sure if this change of behavior in 'require' + file-loader is by design or a bug. Trying to use !!file-loader yields the same result.
Another option could be to use copy-webpack-plugin with [hash] but then how to link to the new name in index.html?