@atlaspack/runtime-browser-hmr 2.15.20-dev-9ef951846.0 → 2.15.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/HMRRuntime.js +2 -0
- package/dist/loaders/hmr-runtime.js +33 -5
- package/lib/HMRRuntime.js +8 -1
- package/lib/loaders/hmr-runtime.js +34 -5
- package/package.json +5 -5
- package/src/HMRRuntime.ts +4 -0
- package/src/loaders/hmr-runtime.ts +41 -5
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/LICENSE +0 -201
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaspack/runtime-browser-hmr
|
|
2
2
|
|
|
3
|
+
## 2.15.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1076](https://github.com/atlassian-labs/atlaspack/pull/1076) [`c4a3b39`](https://github.com/atlassian-labs/atlaspack/commit/c4a3b399c70a434625626af3f7e9b666045cdf39) Thanks [@alexzherdev](https://github.com/alexzherdev)! - Alternative HMR versioning behind feature flag
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`c4a3b39`](https://github.com/atlassian-labs/atlaspack/commit/c4a3b399c70a434625626af3f7e9b666045cdf39)]:
|
|
10
|
+
- @atlaspack/feature-flags@2.31.3
|
|
11
|
+
- @atlaspack/utils@3.4.5
|
|
12
|
+
- @atlaspack/plugin@2.14.63
|
|
13
|
+
|
|
3
14
|
## 2.15.19
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/HMRRuntime.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const plugin_1 = require("@atlaspack/plugin");
|
|
7
|
+
const feature_flags_1 = require("@atlaspack/feature-flags");
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
// Without this, the hmr-runtime.js is transpiled with the React Refresh swc transform because it
|
|
@@ -42,6 +43,7 @@ exports.default = new plugin_1.Runtime({
|
|
|
42
43
|
`var HMR_USE_SSE = ${JSON.stringify(
|
|
43
44
|
// @ts-expect-error TS2339
|
|
44
45
|
!!(process.env.ATLASPACK_BUILD_REPL && process.browser))};` +
|
|
46
|
+
`var HMR_ENABLE_BUNDLE_VERSION = ${JSON.stringify((0, feature_flags_1.getFeatureFlag)('hmrBundleVersioning'))};` +
|
|
45
47
|
`module.bundle.HMR_BUNDLE_ID = ${JSON.stringify(bundle.id)};` +
|
|
46
48
|
HMR_RUNTIME,
|
|
47
49
|
isEntry: true,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */
|
|
2
|
+
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope, HMR_ENABLE_BUNDLE_VERSION */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
// /flow-to-ts helpers
|
|
5
5
|
var OVERLAY_ID = '__parcel__error__overlay__';
|
|
6
|
+
var HMR_BUNDLE_VERSION = '__parcel__hmrBundleVersion';
|
|
6
7
|
// @ts-expect-error TS2339
|
|
7
8
|
var OldModule = module.bundle.Module;
|
|
8
9
|
function Module(moduleName) {
|
|
@@ -38,6 +39,32 @@ disposedAssets /*: {|[string]: boolean|} */,
|
|
|
38
39
|
assetsToDispose /*: Array<[ParcelRequire, string]> */,
|
|
39
40
|
// @ts-expect-error TS7034
|
|
40
41
|
assetsToAccept /*: Array<[ParcelRequire, string]> */;
|
|
42
|
+
function getBundleVersion() {
|
|
43
|
+
// @ts-expect-error TS7017
|
|
44
|
+
return globalThis[HMR_BUNDLE_VERSION];
|
|
45
|
+
}
|
|
46
|
+
function bumpBundleVersion() {
|
|
47
|
+
// @ts-expect-error TS2304
|
|
48
|
+
if (!HMR_ENABLE_BUNDLE_VERSION) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
let version = getBundleVersion();
|
|
52
|
+
let nextVersion = typeof version === 'number' && Number.isFinite(version) ? version + 1 : 1;
|
|
53
|
+
// @ts-expect-error TS7017
|
|
54
|
+
globalThis[HMR_BUNDLE_VERSION] = nextVersion;
|
|
55
|
+
return nextVersion;
|
|
56
|
+
}
|
|
57
|
+
function appendBundleVersion(url) {
|
|
58
|
+
// @ts-expect-error TS2304
|
|
59
|
+
if (!HMR_ENABLE_BUNDLE_VERSION) {
|
|
60
|
+
return url + (url.includes('?') ? '&' : '?') + 't=' + Date.now();
|
|
61
|
+
}
|
|
62
|
+
let version = getBundleVersion();
|
|
63
|
+
if (version == null) {
|
|
64
|
+
return url;
|
|
65
|
+
}
|
|
66
|
+
return url + (url.includes('?') ? '&' : '?') + 't=' + version;
|
|
67
|
+
}
|
|
41
68
|
function getHostname() {
|
|
42
69
|
return (
|
|
43
70
|
// @ts-expect-error TS2304
|
|
@@ -124,6 +151,7 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
|
|
124
151
|
hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle)));
|
|
125
152
|
});
|
|
126
153
|
if (handled) {
|
|
154
|
+
bumpBundleVersion();
|
|
127
155
|
console.clear();
|
|
128
156
|
// Dispatch custom event so other runtimes (e.g React Refresh) are aware.
|
|
129
157
|
if (typeof window !== 'undefined' &&
|
|
@@ -267,7 +295,7 @@ function updateLink(link) {
|
|
|
267
295
|
}
|
|
268
296
|
};
|
|
269
297
|
// @ts-expect-error TS2339
|
|
270
|
-
newLink.setAttribute('href', href
|
|
298
|
+
newLink.setAttribute('href', appendBundleVersion(href));
|
|
271
299
|
// @ts-expect-error TS18047
|
|
272
300
|
link.parentNode.insertBefore(newLink, link.nextSibling);
|
|
273
301
|
}
|
|
@@ -307,7 +335,7 @@ function hmrDownload(asset) {
|
|
|
307
335
|
if (asset.type === 'js') {
|
|
308
336
|
if (typeof document !== 'undefined') {
|
|
309
337
|
let script = document.createElement('script');
|
|
310
|
-
script.src = asset.url
|
|
338
|
+
script.src = appendBundleVersion(asset.url);
|
|
311
339
|
if (asset.outputFormat === 'esmodule') {
|
|
312
340
|
script.type = 'module';
|
|
313
341
|
}
|
|
@@ -322,13 +350,13 @@ function hmrDownload(asset) {
|
|
|
322
350
|
// Worker scripts
|
|
323
351
|
if (asset.outputFormat === 'esmodule') {
|
|
324
352
|
// @ts-expect-error TS2304
|
|
325
|
-
return __parcel__import__(asset.url
|
|
353
|
+
return __parcel__import__(appendBundleVersion(asset.url));
|
|
326
354
|
}
|
|
327
355
|
else {
|
|
328
356
|
return new Promise((resolve, reject) => {
|
|
329
357
|
try {
|
|
330
358
|
// @ts-expect-error TS2304
|
|
331
|
-
__parcel__importScripts__(asset.url
|
|
359
|
+
__parcel__importScripts__(appendBundleVersion(asset.url));
|
|
332
360
|
// @ts-expect-error TS2794
|
|
333
361
|
resolve();
|
|
334
362
|
}
|
package/lib/HMRRuntime.js
CHANGED
|
@@ -11,6 +11,13 @@ function _plugin() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
+
function _featureFlags() {
|
|
15
|
+
const data = require("@atlaspack/feature-flags");
|
|
16
|
+
_featureFlags = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
14
21
|
function _fs() {
|
|
15
22
|
const data = _interopRequireDefault(require("fs"));
|
|
16
23
|
_fs = function () {
|
|
@@ -54,7 +61,7 @@ var _default = exports.default = new (_plugin().Runtime)({
|
|
|
54
61
|
// in watch mode or if hmr port != serve port
|
|
55
62
|
!options.serveOptions || options.serveOptions.port !== port) ? port : null)};` + `var HMR_SECURE = ${JSON.stringify(!!(options.serveOptions && options.serveOptions.https))};` + `var HMR_ENV_HASH = "${bundle.env.id}";` + `var HMR_USE_SSE = ${JSON.stringify(
|
|
56
63
|
// @ts-expect-error TS2339
|
|
57
|
-
!!(process.env.ATLASPACK_BUILD_REPL && process.browser))};` + `module.bundle.HMR_BUNDLE_ID = ${JSON.stringify(bundle.id)};` + HMR_RUNTIME,
|
|
64
|
+
!!(process.env.ATLASPACK_BUILD_REPL && process.browser))};` + `var HMR_ENABLE_BUNDLE_VERSION = ${JSON.stringify((0, _featureFlags().getFeatureFlag)('hmrBundleVersioning'))};` + `module.bundle.HMR_BUNDLE_ID = ${JSON.stringify(bundle.id)};` + HMR_RUNTIME,
|
|
58
65
|
isEntry: true,
|
|
59
66
|
env: {
|
|
60
67
|
sourceType: 'module'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */
|
|
3
|
+
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope, HMR_ENABLE_BUNDLE_VERSION */
|
|
4
4
|
|
|
5
5
|
/*::
|
|
6
6
|
import type {
|
|
@@ -42,6 +42,7 @@ declare var HMR_PORT: string;
|
|
|
42
42
|
declare var HMR_ENV_HASH: string;
|
|
43
43
|
declare var HMR_SECURE: boolean;
|
|
44
44
|
declare var HMR_USE_SSE: boolean;
|
|
45
|
+
declare var HMR_ENABLE_BUNDLE_VERSION: boolean;
|
|
45
46
|
declare var chrome: ExtensionContext;
|
|
46
47
|
declare var browser: ExtensionContext;
|
|
47
48
|
declare var __parcel__import__: (string) => Promise<void>;
|
|
@@ -55,6 +56,7 @@ declare var ServiceWorkerGlobalScope: Object;
|
|
|
55
56
|
// /flow-to-ts helpers
|
|
56
57
|
|
|
57
58
|
var OVERLAY_ID = '__parcel__error__overlay__';
|
|
59
|
+
var HMR_BUNDLE_VERSION = '__parcel__hmrBundleVersion';
|
|
58
60
|
|
|
59
61
|
// @ts-expect-error TS2339
|
|
60
62
|
var OldModule = module.bundle.Module;
|
|
@@ -92,6 +94,32 @@ var checkedAssets /*: {|[string]: boolean|} */,
|
|
|
92
94
|
assetsToDispose /*: Array<[ParcelRequire, string]> */,
|
|
93
95
|
// @ts-expect-error TS7034
|
|
94
96
|
assetsToAccept /*: Array<[ParcelRequire, string]> */;
|
|
97
|
+
function getBundleVersion() {
|
|
98
|
+
// @ts-expect-error TS7017
|
|
99
|
+
return globalThis[HMR_BUNDLE_VERSION];
|
|
100
|
+
}
|
|
101
|
+
function bumpBundleVersion() {
|
|
102
|
+
// @ts-expect-error TS2304
|
|
103
|
+
if (!HMR_ENABLE_BUNDLE_VERSION) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
let version = getBundleVersion();
|
|
107
|
+
let nextVersion = typeof version === 'number' && Number.isFinite(version) ? version + 1 : 1;
|
|
108
|
+
// @ts-expect-error TS7017
|
|
109
|
+
globalThis[HMR_BUNDLE_VERSION] = nextVersion;
|
|
110
|
+
return nextVersion;
|
|
111
|
+
}
|
|
112
|
+
function appendBundleVersion(url) {
|
|
113
|
+
// @ts-expect-error TS2304
|
|
114
|
+
if (!HMR_ENABLE_BUNDLE_VERSION) {
|
|
115
|
+
return url + (url.includes('?') ? '&' : '?') + 't=' + Date.now();
|
|
116
|
+
}
|
|
117
|
+
let version = getBundleVersion();
|
|
118
|
+
if (version == null) {
|
|
119
|
+
return url;
|
|
120
|
+
}
|
|
121
|
+
return url + (url.includes('?') ? '&' : '?') + 't=' + version;
|
|
122
|
+
}
|
|
95
123
|
function getHostname() {
|
|
96
124
|
return (
|
|
97
125
|
// @ts-expect-error TS2304
|
|
@@ -173,6 +201,7 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
|
|
173
201
|
hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle);
|
|
174
202
|
});
|
|
175
203
|
if (handled) {
|
|
204
|
+
bumpBundleVersion();
|
|
176
205
|
console.clear();
|
|
177
206
|
|
|
178
207
|
// Dispatch custom event so other runtimes (e.g React Refresh) are aware.
|
|
@@ -304,7 +333,7 @@ function updateLink(link) {
|
|
|
304
333
|
}
|
|
305
334
|
};
|
|
306
335
|
// @ts-expect-error TS2339
|
|
307
|
-
newLink.setAttribute('href', href
|
|
336
|
+
newLink.setAttribute('href', appendBundleVersion(href));
|
|
308
337
|
// @ts-expect-error TS18047
|
|
309
338
|
link.parentNode.insertBefore(newLink, link.nextSibling);
|
|
310
339
|
}
|
|
@@ -345,7 +374,7 @@ function hmrDownload(asset) {
|
|
|
345
374
|
if (asset.type === 'js') {
|
|
346
375
|
if (typeof document !== 'undefined') {
|
|
347
376
|
let script = document.createElement('script');
|
|
348
|
-
script.src = asset.url
|
|
377
|
+
script.src = appendBundleVersion(asset.url);
|
|
349
378
|
if (asset.outputFormat === 'esmodule') {
|
|
350
379
|
script.type = 'module';
|
|
351
380
|
}
|
|
@@ -360,12 +389,12 @@ function hmrDownload(asset) {
|
|
|
360
389
|
// Worker scripts
|
|
361
390
|
if (asset.outputFormat === 'esmodule') {
|
|
362
391
|
// @ts-expect-error TS2304
|
|
363
|
-
return __parcel__import__(asset.url
|
|
392
|
+
return __parcel__import__(appendBundleVersion(asset.url));
|
|
364
393
|
} else {
|
|
365
394
|
return new Promise((resolve, reject) => {
|
|
366
395
|
try {
|
|
367
396
|
// @ts-expect-error TS2304
|
|
368
|
-
__parcel__importScripts__(asset.url
|
|
397
|
+
__parcel__importScripts__(appendBundleVersion(asset.url));
|
|
369
398
|
// @ts-expect-error TS2794
|
|
370
399
|
resolve();
|
|
371
400
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaspack/runtime-browser-hmr",
|
|
3
|
-
"version": "2.15.20
|
|
3
|
+
"version": "2.15.20",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"node": ">= 16.0.0"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@atlaspack/
|
|
20
|
-
"@atlaspack/
|
|
19
|
+
"@atlaspack/feature-flags": "2.31.3",
|
|
20
|
+
"@atlaspack/plugin": "2.14.63",
|
|
21
|
+
"@atlaspack/utils": "3.4.5"
|
|
21
22
|
},
|
|
22
23
|
"type": "commonjs",
|
|
23
24
|
"scripts": {
|
|
24
25
|
"build:lib": "gulp build --gulpfile ../../../gulpfile.js --cwd ."
|
|
25
|
-
}
|
|
26
|
-
"gitHead": "9ef951846054ca4eacd2d24047ae09e451f72824"
|
|
26
|
+
}
|
|
27
27
|
}
|
package/src/HMRRuntime.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {Runtime} from '@atlaspack/plugin';
|
|
2
|
+
import {getFeatureFlag} from '@atlaspack/feature-flags';
|
|
2
3
|
import fs from 'fs';
|
|
3
4
|
import path from 'path';
|
|
4
5
|
|
|
@@ -55,6 +56,9 @@ export default new Runtime({
|
|
|
55
56
|
// @ts-expect-error TS2339
|
|
56
57
|
!!(process.env.ATLASPACK_BUILD_REPL && process.browser),
|
|
57
58
|
)};` +
|
|
59
|
+
`var HMR_ENABLE_BUNDLE_VERSION = ${JSON.stringify(
|
|
60
|
+
getFeatureFlag('hmrBundleVersioning'),
|
|
61
|
+
)};` +
|
|
58
62
|
`module.bundle.HMR_BUNDLE_ID = ${JSON.stringify(bundle.id)};` +
|
|
59
63
|
HMR_RUNTIME,
|
|
60
64
|
isEntry: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */
|
|
1
|
+
/* global HMR_HOST, HMR_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope, HMR_ENABLE_BUNDLE_VERSION */
|
|
2
2
|
|
|
3
3
|
/*::
|
|
4
4
|
import type {
|
|
@@ -40,6 +40,7 @@ declare var HMR_PORT: string;
|
|
|
40
40
|
declare var HMR_ENV_HASH: string;
|
|
41
41
|
declare var HMR_SECURE: boolean;
|
|
42
42
|
declare var HMR_USE_SSE: boolean;
|
|
43
|
+
declare var HMR_ENABLE_BUNDLE_VERSION: boolean;
|
|
43
44
|
declare var chrome: ExtensionContext;
|
|
44
45
|
declare var browser: ExtensionContext;
|
|
45
46
|
declare var __parcel__import__: (string) => Promise<void>;
|
|
@@ -57,6 +58,7 @@ export type Diff<T extends U, U extends object> = Pick<
|
|
|
57
58
|
// /flow-to-ts helpers
|
|
58
59
|
|
|
59
60
|
var OVERLAY_ID = '__parcel__error__overlay__';
|
|
61
|
+
var HMR_BUNDLE_VERSION = '__parcel__hmrBundleVersion';
|
|
60
62
|
|
|
61
63
|
// @ts-expect-error TS2339
|
|
62
64
|
var OldModule = module.bundle.Module;
|
|
@@ -96,6 +98,39 @@ var checkedAssets /*: {|[string]: boolean|} */,
|
|
|
96
98
|
// @ts-expect-error TS7034
|
|
97
99
|
assetsToAccept /*: Array<[ParcelRequire, string]> */;
|
|
98
100
|
|
|
101
|
+
function getBundleVersion() {
|
|
102
|
+
// @ts-expect-error TS7017
|
|
103
|
+
return globalThis[HMR_BUNDLE_VERSION];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function bumpBundleVersion() {
|
|
107
|
+
// @ts-expect-error TS2304
|
|
108
|
+
if (!HMR_ENABLE_BUNDLE_VERSION) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
let version = getBundleVersion();
|
|
113
|
+
let nextVersion =
|
|
114
|
+
typeof version === 'number' && Number.isFinite(version) ? version + 1 : 1;
|
|
115
|
+
// @ts-expect-error TS7017
|
|
116
|
+
globalThis[HMR_BUNDLE_VERSION] = nextVersion;
|
|
117
|
+
return nextVersion;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function appendBundleVersion(url: string) {
|
|
121
|
+
// @ts-expect-error TS2304
|
|
122
|
+
if (!HMR_ENABLE_BUNDLE_VERSION) {
|
|
123
|
+
return url + (url.includes('?') ? '&' : '?') + 't=' + Date.now();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let version = getBundleVersion();
|
|
127
|
+
if (version == null) {
|
|
128
|
+
return url;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return url + (url.includes('?') ? '&' : '?') + 't=' + version;
|
|
132
|
+
}
|
|
133
|
+
|
|
99
134
|
function getHostname() {
|
|
100
135
|
return (
|
|
101
136
|
// @ts-expect-error TS2304
|
|
@@ -199,6 +234,7 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
|
|
|
199
234
|
});
|
|
200
235
|
|
|
201
236
|
if (handled) {
|
|
237
|
+
bumpBundleVersion();
|
|
202
238
|
console.clear();
|
|
203
239
|
|
|
204
240
|
// Dispatch custom event so other runtimes (e.g React Refresh) are aware.
|
|
@@ -389,7 +425,7 @@ function updateLink(link: HTMLElement) {
|
|
|
389
425
|
}
|
|
390
426
|
};
|
|
391
427
|
// @ts-expect-error TS2339
|
|
392
|
-
newLink.setAttribute('href', href
|
|
428
|
+
newLink.setAttribute('href', appendBundleVersion(href));
|
|
393
429
|
// @ts-expect-error TS18047
|
|
394
430
|
link.parentNode.insertBefore(newLink, link.nextSibling);
|
|
395
431
|
}
|
|
@@ -437,7 +473,7 @@ function hmrDownload(asset: HMRAsset) {
|
|
|
437
473
|
if (asset.type === 'js') {
|
|
438
474
|
if (typeof document !== 'undefined') {
|
|
439
475
|
let script = document.createElement('script');
|
|
440
|
-
script.src = asset.url
|
|
476
|
+
script.src = appendBundleVersion(asset.url);
|
|
441
477
|
if (asset.outputFormat === 'esmodule') {
|
|
442
478
|
script.type = 'module';
|
|
443
479
|
}
|
|
@@ -458,7 +494,7 @@ function hmrDownload(asset: HMRAsset) {
|
|
|
458
494
|
// Worker scripts
|
|
459
495
|
if (asset.outputFormat === 'esmodule') {
|
|
460
496
|
// @ts-expect-error TS2304
|
|
461
|
-
return __parcel__import__(asset.url
|
|
497
|
+
return __parcel__import__(appendBundleVersion(asset.url));
|
|
462
498
|
} else {
|
|
463
499
|
return new Promise(
|
|
464
500
|
(
|
|
@@ -467,7 +503,7 @@ function hmrDownload(asset: HMRAsset) {
|
|
|
467
503
|
) => {
|
|
468
504
|
try {
|
|
469
505
|
// @ts-expect-error TS2304
|
|
470
|
-
__parcel__importScripts__(asset.url
|
|
506
|
+
__parcel__importScripts__(appendBundleVersion(asset.url));
|
|
471
507
|
// @ts-expect-error TS2794
|
|
472
508
|
resolve();
|
|
473
509
|
} catch (err: any) {
|