Skip to content

Commit 7c44add

Browse files
committed
Move back to old packager
Fixes the issue with #1807
1 parent a96f34a commit 7c44add

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

packages/app/src/sandbox/eval/manager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import { SerializedTranspiledModule } from './transpiled-module';
1313
import Preset from './presets';
1414
import { SCRIPT_VERSION } from '../';
1515
import fetchModule, {
16-
getCombinedMetas,
1716
setCombinedMetas,
17+
combinedMetas,
1818
} from './npm/fetch-npm-module';
1919
import coreLibraries from './npm/get-core-libraries';
2020
import getDependencyName from './utils/get-dependency-name';
@@ -223,7 +223,7 @@ export default class Manager {
223223
if (this.stage === 'transpilation') {
224224
// In transpilation phase we can afford to download the file if not found,
225225
// because we're async. That's why we also include the meta here.
226-
returnValue = this.transpiledModules[p] || getCombinedMetas()[p];
226+
returnValue = this.transpiledModules[p] || combinedMetas[p];
227227
} else {
228228
returnValue = this.transpiledModules[p];
229229
}
@@ -1049,7 +1049,7 @@ export default class Manager {
10491049
const dependenciesQuery = this.getDependencyQuery();
10501050

10511051
const meta = {};
1052-
Object.keys(getCombinedMetas() || {}).forEach(p => {
1052+
Object.keys(combinedMetas || {}).forEach(p => {
10531053
const dir = pathUtils.dirname(p.replace('/node_modules', ''));
10541054
meta[dir] = meta[dir] || [];
10551055
meta[dir].push(pathUtils.basename(p));

packages/app/src/sandbox/eval/npm/fetch-npm-module.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import * as pathUtils from '@codesandbox/common/lib/utils/path';
32
import resolve from 'browser-resolve';
43
import DependencyNotFoundError from 'sandbox-hooks/errors/dependency-not-found-error';
@@ -28,14 +27,10 @@ type MetaFiles = Array<{
2827
}>;
2928

3029
const metas: Metas = {};
31-
let combinedMetas: Meta = {};
30+
export let combinedMetas: Meta = {};
3231
const normalizedMetas: { [key: string]: Meta } = {};
3332
const packages: Packages = {};
3433

35-
export function getCombinedMetas() {
36-
return combinedMetas;
37-
}
38-
3934
export function setCombinedMetas(givenCombinedMetas: Meta) {
4035
combinedMetas = givenCombinedMetas;
4136
}

packages/app/src/sandbox/npm/fetch-dependencies.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ const VERSION = 1;
1818

1919
const BUCKET_URL =
2020
process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test'
21-
? 'https://prod-packager-packages.codesandbox.io'
21+
? 'https://d1jyvh0kxilfa7.cloudfront.net'
2222
: 'https://dev-packager-packages.codesandbox.io';
2323

24-
// const NEW_PACKAGER_URL =
25-
// 'https://aiwi8rnkp5.execute-api.eu-west-1.amazonaws.com/prod/packages';
24+
const NEW_PACKAGER_URL =
25+
'https://aiwi8rnkp5.execute-api.eu-west-1.amazonaws.com/prod/packages';
2626

2727
const PACKAGER_URL =
2828
process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test'
29-
? 'https://aiwi8rnkp5.execute-api.eu-west-1.amazonaws.com/prod/packages'
29+
? 'https://drq28qbjmc.execute-api.eu-west-1.amazonaws.com/prod/packages'
3030
: 'https://xi5p9f7czk.execute-api.eu-west-1.amazonaws.com/dev/packages';
3131

32-
// function warmupPackager(url: string, method = 'GET') {
33-
// fetch(url, {
34-
// method,
35-
// })
36-
// .then(() => {})
37-
// .catch(() => {});
38-
// }
32+
function warmupPackager(url: string, method = 'GET') {
33+
fetch(url, {
34+
method,
35+
})
36+
.then(() => {})
37+
.catch(() => {});
38+
}
3939

4040
function callApi(url: string, method = 'GET') {
4141
return fetch(url, {
@@ -122,7 +122,7 @@ async function getDependencies(dependencies: Object) {
122122
const bucketDependencyUrl = dependenciesToBucketPath(absoluteDependencies);
123123

124124
setScreen({ type: 'loading', text: 'Downloading Dependencies...' });
125-
// warmupPackager(`${NEW_PACKAGER_URL}/${dependencyUrl}`, 'POST');
125+
warmupPackager(`${NEW_PACKAGER_URL}/${dependencyUrl}`, 'POST');
126126
try {
127127
const bucketManifest = await callApi(
128128
`${BUCKET_URL}/${bucketDependencyUrl}`

0 commit comments

Comments
 (0)