Never cache source files in dev mode
Summary: Some times chrome caches the output from metro bundler, meaning when developing, it uses old source files and your changes have no effect. This fixes that by adding dont-cache to the headers of all files served. Reviewed By: danielbuechele Differential Revision: D12922357 fbshipit-source-id: 2c3bdf8fb60e4ec64ace2c21f6b1e4656f885339
This commit is contained in:
committed by
Facebook Github Bot
parent
a0800b079a
commit
ad98ba3235
@@ -79,6 +79,13 @@ function startAssetServer(port) {
|
||||
next();
|
||||
});
|
||||
|
||||
app.use((req, res, next) => {
|
||||
res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate');
|
||||
res.header('Expires', '-1');
|
||||
res.header('Pragma', 'no-cache');
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
fs.readFile(path.join(STATIC_DIR, 'index.dev.html'), (err, content) => {
|
||||
res.end(content);
|
||||
|
||||
Reference in New Issue
Block a user