diff --git a/hmr/hmr-update.ts b/hmr/hmr-update.ts index 6ad9b3d1..e4778c33 100644 --- a/hmr/hmr-update.ts +++ b/hmr/hmr-update.ts @@ -1,10 +1,13 @@ import * as hot from "../hot"; -import { knownFolders } from "tns-core-modules/file-system"; +import { knownFolders, path, File } from "tns-core-modules/file-system"; declare const __webpack_require__: any; export function hmrUpdate() { - const applicationFiles = knownFolders.currentApp(); + const currentAppFolder = knownFolders.currentApp(); const latestHash = __webpack_require__["h"](); - return hot(latestHash, filename => applicationFiles.getFile(filename)); + return hot(latestHash, filename => { + const fullFilePath = path.join(currentAppFolder.path, filename); + return File.exists(fullFilePath) ? currentAppFolder.getFile(filename) : null; + }); } \ No newline at end of file diff --git a/hot.js b/hot.js index 84de3b1e..4d9f5c77 100644 --- a/hot.js +++ b/hot.js @@ -147,6 +147,10 @@ function update(latestHash, options) { function getNextHash(hash, getFileContent) { const file = getFileContent(`${hash}.hot-update.json`); + if (!file) { + return Promise.resolve(hash); + } + return file.readText().then(hotUpdateContent => { if (hotUpdateContent) { const manifest = JSON.parse(hotUpdateContent);