If you are using the [contenthash] as a query string, the integrity hashes are not generated.
Example webpack.config.js
const Encore = require('@symfony/webpack-encore');
Encore
// directory where compiled assets will be stored
.setOutputPath('build/')
// public path used by the web server to access the output path
.setPublicPath('/build/')
.setManifestKeyPrefix('build/')
// hash as querystring instead of in filename
.configureFilenames({
js: '[name].js?[contenthash]',
})
.addEntry('example', './src/example.js')
.disableSingleRuntimeChunk()
.enableVersioning(Encore.isProduction())
.enableIntegrityHashes(Encore.isProduction())
;
module.exports = Encore.getWebpackConfig();
If you are using the
[contenthash]
as a query string, the integrity hashes are not generated.Example webpack.config.js
Generated entrypoints.json
The problem exists, because
entry-files-manifest.js
assumes the filename is a a valid file: https://github.com/symfony/webpack-encore/blob/6b75c4dd963c613ddc19fa2748e0b6bcc4512c16/lib/plugins/entry-files-manifest.js#L52-L57If the query string would be stripped, the file path should be correct.