8000 fix: HMR event and sourcemaps reload · fuse-box/fuse-box@86d9811 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 86d9811

Browse files
committed
fix: HMR event and sourcemaps reload
closes #1324
1 parent e37caef commit 86d9811

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/BundleSource.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ ${file.headerContent ? file.headerContent.join("\n") : ""}`);
256256
}
257257
if (this.context.sourceMapsProject || this.context.sourceMapsVendor) {
258258
let sourceName = /[^\/]*$/.exec(this.context.output.filename)[0];
259-
this.concat.add(null, `//# sourceMappingURL=${sourceName}.js.map`);
259+
260+
this.concat.add(null, `//# sourceMappingURL=${sourceName}.js.map?tm=${this.context.cacheBustPreffix}`);
260261
}
261262
}
262263

src/core/File.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ export class File {
679679
}
680680
result.outputText = result
681681
.outputText
682-
.replace(`//# sourceMappingURL=${this.info.fuseBoxPath}.map`, `//# sourceMappingURL=${this.context.bundle.name}.js.map`)
682+
.replace(`//# sourceMappingURL=${this.info.fuseBoxPath}.map`, `//# sourceMappingURL=${this.context.bundle.name}.js.map?tm=${this.context.cacheBustPreffix}`)
683683
.replace("//# sourceMappingURL=module.js.map", "");
684684
this.sourceMap = JSON.stringify(jsonSourceMaps);
685685
}

src/core/WorkflowContext.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ export class WorkFlowContext {
6969
*/
7070
public appRoot: any = appRoot.path;
7171

72+
public cacheBustPreffix : string;
73+
7274
public dynamicImportsEnabled = true;
7375

7476
public automaticAlias = true;
@@ -399,6 +401,7 @@ export class WorkFlowContext {
399401
*/
400402
public reset() {
401403
this.log.reset();
404+
this.cacheBustPreffix = new Date().getTime().toString();
402405
this.dependents = new Map<string, Set<string>>();
403406
this.emitter = new NativeEmitter();
404407
this.storage = new Map();

0 commit comments

Comments
 (0)
0