Disable service worker in dev mode

This commit is contained in:
Paulus Schoutsen 2016-08-08 00:08:01 -07:00
parent 3512e5aa25
commit d7f79ff8fa
3 changed files with 13 additions and 1 deletions

View File

@ -9,7 +9,7 @@
"scripts": { "scripts": {
"setup_js_dev": "git submodule init && git submodule update && cd home-assistant-js && npm install", "setup_js_dev": "git submodule init && git submodule update && cd home-assistant-js && npm install",
"clean": "rm -rf build/* build-temp/*", "clean": "rm -rf build/* build-temp/*",
"js_dev": "npm run watch_ru_all", "js_dev": "script/sw-dev.js && npm run watch_ru_all",
"js_dev_demo": "BUILD_DEMO=1 npm run watch_ru_all", "js_dev_demo": "BUILD_DEMO=1 npm run watch_ru_all",
"js_prod": "BUILD_DEV=0 npm run ru_all", "js_prod": "BUILD_DEV=0 npm run ru_all",
"js_demo": "BUILD_DEV=0 BUILD_DEMO=1 npm run ru_all", "js_demo": "BUILD_DEV=0 BUILD_DEMO=1 npm run ru_all",

10
script/sw-dev.js Executable file
View File

@ -0,0 +1,10 @@
#! /usr/bin/env node
var fs = require('fs');
var path = require('path');
var content = `
console.warn('Service worker disabled in dev mode');
`;
fs.writeFileSync(path.join('build', 'service_worker.js'), content);

2
script/sw-precache.js Normal file → Executable file
View File

@ -1,3 +1,5 @@
#! /usr/bin/env node
/* /*
Generate a caching service worker for HA Generate a caching service worker for HA