Skip to content

Commit

Permalink
EPMRPP-86851 || Implement SRI for scripts (#3610)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bam6ycha authored Oct 17, 2023
1 parent e1eec39 commit 841163a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"@babel/preset-env": "7.16.8",
"@babel/preset-react": "7.16.7",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
"@sowtame/webpack-subresource-integrity": "2.0.0",
"@types/jest": "24.9.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
"axios-mock-adapter": "1.17.0",
Expand Down
12 changes: 7 additions & 5 deletions app/webpack/prod.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
// const { SubresourceIntegrityPlugin } = require('webpack-subresource-integrity');
const { SubresourceIntegrityPlugin } = require('@sowtame/webpack-subresource-integrity');
const TerserPlugin = require('terser-webpack-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');

module.exports = {
mode: 'production',
output: {
// crossOriginLoading: 'anonymous',
crossOriginLoading: 'anonymous',
},
module: {
rules: [
Expand Down Expand Up @@ -69,10 +70,11 @@ module.exports = {
minRatio: 0.8,
}),
// TODO: wait until https://github.com/waysact/webpack-subresource-integrity/issues/176 will be resolved
// new SubresourceIntegrityPlugin({
// hashFuncNames: ['sha256', 'sha384'],
// hashLoading: 'lazy',
// }),
// TODO we are forced to use it because of webpack-subresource-integrity has not introduced the fix yet
new SubresourceIntegrityPlugin({
hashFuncNames: ['sha256', 'sha384'],
hashLoading: 'lazy',
}),
],
optimization: {
minimize: true,
Expand Down

0 comments on commit 841163a

Please sign in to comment.