mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #12542 from meteor/fix-static-assets
[Meteor 3] Fix static files on client
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
"dependencies": {
|
||||
"@meteorjs/babel": {
|
||||
"version": "7.19.0-beta.1",
|
||||
"resolved": "https://registry.npmjs.org/@meteorjs/babel/-/babel-7.19.0-beta.1.tgz",
|
||||
"integrity": "sha512-4dy7oSXEo6Eb2PHfPkMX0VVnkQJ9Kb6Qv6/ssiXOqQRtTRpBAgeWeMzUd42u/8VzxG6l8NoNqIhPSOHZjC2usg==",
|
||||
"dependencies": {
|
||||
"@ampproject/remapping": {
|
||||
"version": "2.1.1",
|
||||
|
||||
@@ -184,7 +184,7 @@ export class HMRServer {
|
||||
}
|
||||
}
|
||||
|
||||
compare({ name, arch, hmrAvailable, files, cacheKey }, getFileOutput) {
|
||||
async compare({ name, arch, hmrAvailable, files, cacheKey }, getFileOutput) {
|
||||
if (this.firstBuild = null) {
|
||||
this.firstBuild = Date.now();
|
||||
}
|
||||
@@ -248,20 +248,36 @@ export class HMRServer {
|
||||
onlyReplaceableChanges &&
|
||||
removedFilePaths.length === 0;
|
||||
|
||||
function saveFileDetails(file) {
|
||||
async function saveFileDetails(file) {
|
||||
|
||||
const content = await getFileOutput(file);
|
||||
return {
|
||||
content: getFileOutput(file).toStringWithSourceMap({}),
|
||||
content: content.toStringWithSourceMap({}),
|
||||
path: file.absModuleId,
|
||||
meteorInstallOptions: file.meteorInstallOptions
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: try to improve the performance of this
|
||||
const iterWithFn = async (iter, fn) => {
|
||||
let arr = [];
|
||||
for (let i = 0; i < iter.length; i++) {
|
||||
try {
|
||||
const d = await fn(iter[i]);
|
||||
arr.push(d);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
const result = {
|
||||
fileHashes,
|
||||
unreloadableHashes: unreloadable,
|
||||
reloadable,
|
||||
addedFiles: reloadable ? addedFiles.map(saveFileDetails) : [],
|
||||
changedFiles: reloadable ? changedFiles.map(saveFileDetails) : [],
|
||||
addedFiles: reloadable ? await iterWithFn(addedFiles, saveFileDetails) : [],
|
||||
changedFiles: reloadable ? await iterWithFn(changedFiles, saveFileDetails) : [],
|
||||
linkedAt: Date.now(),
|
||||
id: this._createId(),
|
||||
name
|
||||
|
||||
Reference in New Issue
Block a user