-
With Webpacker 5, I had a working configuration for outputting integrity attributes with this monkeypatch & configuration change: rails/webpacker#323 (comment) Previously, my const { environment } = require('@rails/webpacker')
// Webpacker uses this plugin to generate its manifest but
// at present it does not generate the integrity for each asset.
const manifestPlugin = environment.plugins.get('Manifest');
manifestPlugin.options.integrity = true;
manifestPlugin.options.integrityHashes = ['sha256'];
module.exports = environment For Webpacker 6, it seems like the way to go is to use the However, calling I also tried adding a new const customConfig = {
output: {
crossOriginLoading: 'anonymous'
},
plugins: [new SubresourceIntegrityPlugin(),
new WebpackAssetsManifest({ entrypoints: true,
integrity: true,
writeToDisk: true,
entrypointsUseAssets: true,
publicPath: true,
output: config.manifestPath })]
} However, this just results in an error from both |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @ryanfb the cleanest way I can think of is removing the plugin from the default set before appending yours. Something along the lines of:
The above should discard Think there might be other ways using custom |
Beta Was this translation helpful? Give feedback.
Hey @ryanfb the cleanest way I can think of is removing the plugin from the default set before appending yours. Something along the lines of:
The above should discard
WebpackAssetsManifest
plugin from the default list and after merge, you should have your own one there instead.Think there might be other ways using …