Skip to content

Commit f531cbf

Browse files
author
Daniel Spitzer
committed
Add webpack-subresource-integrity
1 parent e0c3df4 commit f531cbf

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"preact-compat-enzyme": "^0.2.5",
3434
"preact-render-to-json": "^3.6.6",
3535
"preact-test-utils": "^0.1.3",
36-
"source-map-explorer": "^1.5.0"
36+
"source-map-explorer": "^1.5.0",
37+
"webpack-subresource-integrity": "^1.1.0-rc.4"
3738
}
3839
}

scripts/build.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ const babelConfig = require('babel-preset-react-app');
99
babelIE11(babelConfig);
1010

1111
const webpackPreact = require('./patch/webpackPreact');
12+
const webpackSRI = require('./patch/webpackSRI');
1213
const webpackConfig = require('react-scripts/config/webpack.config.prod');
1314
webpackPreact(webpackConfig);
15+
webpackSRI(webpackConfig);
1416

1517
require('react-scripts/scripts/build');

scripts/patch/webpackSRI.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const SriPlugin = require('webpack-subresource-integrity');
2+
3+
module.exports = webpackConfig => {
4+
webpackConfig.plugins.push(
5+
new SriPlugin({
6+
hashFuncNames: ['sha384'],
7+
enabled: true
8+
})
9+
);
10+
webpackConfig.output.crossOriginLoading = 'anonymous';
11+
};

yarn.lock

+18-1
Original file line numberDiff line numberDiff line change
@@ -6447,6 +6447,10 @@ source-list-map@^2.0.0:
64476447
version "2.0.0"
64486448
resolved "https://npm.tradeshift.net/repository/npm-all/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"
64496449

6450+
source-list-map@~0.1.7:
6451+
version "0.1.8"
6452+
resolved "https://npm.tradeshift.net/repository/npm-all/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106"
6453+
64506454
source-map-explorer@^1.5.0:
64516455
version "1.5.0"
64526456
resolved "https://npm.tradeshift.net/repository/npm-all/source-map-explorer/-/source-map-explorer-1.5.0.tgz#654e2ba0db158fecfc99b9cefdf891b755b767d1"
@@ -6484,7 +6488,7 @@ [email protected], source-map@^0.5.1, source-map@^0.5.3, source-map@^0.5.6, sourc
64846488
version "0.5.7"
64856489
resolved "https://npm.tradeshift.net/repository/npm-all/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
64866490

6487-
source-map@^0.4.4:
6491+
source-map@^0.4.4, source-map@~0.4.1:
64886492
version "0.4.4"
64896493
resolved "https://npm.tradeshift.net/repository/npm-all/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
64906494
dependencies:
@@ -7201,6 +7205,13 @@ webidl-conversions@^4.0.0:
72017205
version "4.0.2"
72027206
resolved "https://npm.tradeshift.net/repository/npm-all/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
72037207

7208+
webpack-core@^0.6.8:
7209+
version "0.6.9"
7210+
resolved "https://npm.tradeshift.net/repository/npm-all/webpack-core/-/webpack-core-0.6.9.tgz#fc571588c8558da77be9efb6debdc5a3b172bdc2"
7211+
dependencies:
7212+
source-list-map "~0.1.7"
7213+
source-map "~0.4.1"
7214+
72047215
webpack-dev-middleware@^1.11.0:
72057216
version "1.12.2"
72067217
resolved "https://npm.tradeshift.net/repository/npm-all/webpack-dev-middleware/-/webpack-dev-middleware-1.12.2.tgz#f8fc1120ce3b4fc5680ceecb43d777966b21105e"
@@ -7257,6 +7268,12 @@ webpack-sources@^1.0.1:
72577268
source-list-map "^2.0.0"
72587269
source-map "~0.6.1"
72597270

7271+
webpack-subresource-integrity@^1.1.0-rc.4:
7272+
version "1.1.0-rc.4"
7273+
resolved "https://npm.tradeshift.net/repository/npm-all/webpack-subresource-integrity/-/webpack-subresource-integrity-1.1.0-rc.4.tgz#c5c4e3d690f9d2f64a9550e07a8767f9796aa5d8"
7274+
dependencies:
7275+
webpack-core "^0.6.8"
7276+
72607277
72617278
version "3.8.1"
72627279
resolved "https://npm.tradeshift.net/repository/npm-all/webpack/-/webpack-3.8.1.tgz#b16968a81100abe61608b0153c9159ef8bb2bd83"

0 commit comments

Comments
 (0)