Skip to content

Commit 0ed707d

Browse files
author
Ives van Hoorne
committed
Fix svelte
1 parent 1ab1918 commit 0ed707d

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

src/sandbox/compile.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ async function compile({
120120
updateManager(sandboxId, template, managerModules, experimentalPackager),
121121
]);
122122

123-
const { externals = {} } = manifest;
124-
123+
const { externals = {} } = manifest || {};
125124
if (experimentalPackager) {
126125
manager.setManifest(manifest);
127126
} else {

src/sandbox/eval/manager.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import * as pathUtils from 'common/utils/path';
77
import type { Module } from './entities/module';
88
import TranspiledModule from './transpiled-module';
99
import Preset from './presets';
10-
import nodeResolvePath from './utils/node-resolve-path';
1110
import fetchModule from './npm/fetch-npm-module';
1211
import DependencyNotFoundError from '../errors/dependency-not-found-error';
1312
import ModuleNotFoundError from '../errors/module-not-found-error';
@@ -76,14 +75,19 @@ export default class Manager {
7675
this.externals = externals;
7776
}
7877

79-
setManifest(manifest: Manifest) {
80-
this.manifest = manifest;
78+
setManifest(manifest: ?Manifest) {
79+
this.manifest = manifest || {
80+
contents: {},
81+
dependencies: [],
82+
dependencyDependencies: {},
83+
dependencyAliases: {},
84+
};
8185

82-
Object.keys(manifest.contents).forEach(path => {
86+
Object.keys(this.manifest.contents).forEach(path => {
8387
this.addModule({
8488
path,
85-
code: manifest.contents[path].content,
86-
requires: manifest.contents[path].requires,
89+
code: this.manifest.contents[path].content,
90+
requires: this.manifest.contents[path].requires,
8791
});
8892
});
8993
}
@@ -223,12 +227,12 @@ export default class Manager {
223227
: previousDependencyParts[0];
224228

225229
if (
226-
this.manifest[previousDependencyName] &&
227-
this.manifest[previousDependencyName][dependencyName]
230+
this.manifest.dependencyAliases[previousDependencyName] &&
231+
this.manifest.dependencyAliases[previousDependencyName][dependencyName]
228232
) {
229-
const aliasedDependencyName = this.manifest[previousDependencyName][
230-
dependencyName
231-
];
233+
const aliasedDependencyName = this.manifest.dependencyAliases[
234+
previousDependencyName
235+
][dependencyName];
232236

233237
return path.replace(dependencyName, aliasedDependencyName);
234238
}

src/sandbox/npm/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default async function loadDependencies(
6868
}
6969
}
7070
} else {
71-
manifest = {};
71+
manifest = null;
7272
}
7373

7474
return { manifest, isNewCombination };

0 commit comments

Comments
 (0)