Skip to content

Commit fd76952

Browse files
committed
x
1 parent c5bf5b7 commit fd76952

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

generate-firebase-json.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,7 @@ const defaultProcessFn = (builtPolicy, htmlPluginData, $) => {
3030
: $.html();
3131
};
3232

33-
var cspHeadersForSourceGlob = [
34-
{
35-
source: '**/*',
36-
headers: [
37-
{
38-
key: 'Content-Security-Policy',
39-
value: "script-src 'self'",
40-
},
41-
]
42-
},
43-
];
33+
var cspHeadersForSourceGlob = [];
4434

4535
const generateFirebaseJson = (
4636
builtPolicy,
@@ -49,17 +39,22 @@ const generateFirebaseJson = (
4939
compilation,
5040
) => {
5141
const sourcesGlob = htmlPluginData.outputName
52-
.replace(/index\.html/, "(index.html)?")
53-
.replace(/\.html/, "(\\.html)?")
54-
cspHeadersForSourceGlob = [{
55-
source: `^/${sourcesGlob}$`,
56-
headers: [
42+
.replace(/404\.html/, '**/*')
43+
.replace(/index\.html/, '(index.html)?')
44+
.replace(/\.html/, '(\\.html)?')
45+
cspHeadersForSourceGlob = cspHeadersForSourceGlob.concat(
46+
[
5747
{
58-
key: 'Content-Security-Policy',
59-
value: builtPolicy,
60-
}
61-
],
62-
}].concat(cspHeadersForSourceGlob);
48+
source: `^/${sourcesGlob}$`,
49+
headers: [
50+
{
51+
key: 'Content-Security-Policy',
52+
value: builtPolicy,
53+
}
54+
],
55+
}
56+
]
57+
);
6358

6459
transformerFirebase(cspHeadersForSourceGlob);
6560

0 commit comments

Comments
 (0)