firebase.json不适用于ignore和cache-control

时间:2018-05-12 22:31:32

标签: firebase-hosting

我有以下firebase.json配置,但上传的文件数以千计(实际上并非少数)。无法找到文件的位置列表,也无法找到它们的来源。

此外,还会忽略缓存设置。 Haven能够找到有关语法的详细文档。

有什么建议吗?

这是firebase.json文件:

{ "hosting": { "public": "/", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**", "/ts/**", "/js/**", "/config/**", "package.json", "package-lock.json", "README.MD" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ], "headers": [ { "source":"*/dist/**", "headers":[ { "key":"cache-control", "value":"public" }, { "key":"cache-control", "value":"max-age=0" }, { "key":"cache-control", "value":"must-revalidate" } ] }, { "source":"*/public/**", "headers":[ { "key":"cache-control", "value":"public" }, { "key":"cache-control", "value":"max-age=0" }, { "key":"cache-control", "value":"must-revalidate" } ] } ] } }

1 个答案:

答案 0 :(得分:0)

答案:"**/.*"未涵盖.git/,因此需要将"**/.git/**"添加到忽略列表中。

请注意,通过将所有缓存控制指令包含在相同的值中来解决缓存问题。

更正了firebase.json:

{ "hosting": { "public": "/", "ignore": [ "firebase.json", "**/.*", "**/.git/**", "**/node_modules/**", "**/ts/**", "**/js/**", "**/config/**", "package.json", "package-lock.json", "README.MD" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ], "headers": [ { "source":"dist/**", "headers":[ { "key":"cache-control", "value":"public,max-age=0,must-revalidate" } ] }, { "source":"public/**", "headers":[ { "key":"cache-control", "value":"public,max-age=0,must-revalidate" } ] } ] } }

相关问题