Files
NativeScript/packages/webpack/hmr/hmr-update.ts
Nathan Walker 84204cda72 chore: cleanup
2020-07-13 18:02:10 -07:00

14 lines
474 B
TypeScript

import * as hot from '../hot';
declare const __webpack_require__: any;
export function hmrUpdate() {
const coreFile = require('@nativescript/core');
const currentAppFolder = coreFile.knownFolders.currentApp();
const latestHash = __webpack_require__['h']();
return hot(latestHash, (filename) => {
const fullFilePath = coreFile.path.join(currentAppFolder.path, filename);
return coreFile.File.exists(fullFilePath) ? currentAppFolder.getFile(filename) : null;
});
}