简体   繁体   English

部署的Polymer WebApp缓存页面

[英]Deployed polymer webapp caching pages

I have a Polymer webapp initially scaffolded using Yeoman and then deployed to Heroku with the simple following web.coffe script: 我有一个Polymer Webapp,最初使用Yeoman 搭建了支架,然后使用以下简单的web.coffe脚本将其部署到Heroku:

gzippo = require 'gzippo'
express = require 'express'
morgan = require 'morgan'

app = express()
app.use morgan('dev')
app.use gzippo.staticGzip "#{__dirname}/dist"
app.listen process.env.PORT || 5000

The problem I am facing is that (at least in Chrome and Safari) every time I deploy a new version I have to clear the browser cache and data to see the changes. 我面临的问题是(至少在Chrome和Safari中)每次部署新版本时,都必须清除浏览器缓存和数据以查看更改。 Refreshing the page multiple times does not work. 多次刷新页面不起作用。 However with my local grunt server changes happen as expected in the browser UI. 但是,使用本地本地服务器时,浏览器UI会发生预期的更改。

Where can I start inspecting this kind of problem? 我从哪里可以开始检查这种问题?

A workaround, same concept that use in this thread: 一种变通方法,与此线程中使用的概念相同:

Force browser to clear cache 强制浏览器清除缓存

is just add a "version control" in your elements on the link import 只是在链接导入的元素中添加“版本控制”

<link rel="import" href="elements/my-element.html?v=0.02">

It's quite tedius :( 这是很烦人的:(

Another kind of Cache that can happen is the service worker cache and had me struggling for a while. 另一种可能发生的缓存是服务工作者缓存,使我苦苦挣扎了一段时间。
This one if you are on Chrome you need to delete it in dev tools resources tab, there you will see Service Workers on the bottom. 如果您使用的是Chrome浏览器,则需要在“开发工具”资源标签中将其删除,然后在底部看到“服务工作者”。 Just delete everything (trash on top right). 只需删除所有内容(右上角的垃圾箱)即可。

This is not really related to the question but can help fellow Googlers that may pass by. 这实际上与问题无关,但可以帮助可能通过的Google同事。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM