11import { actions , dispatch } from 'codesandbox-api' ;
22import _debug from 'app/utils/debug' ;
3+ import reportError from 'app/utils/error' ;
34import dependenciesToQuery from './dependencies-to-query' ;
45import delay from '../utils/delay' ;
56
@@ -25,7 +26,7 @@ function callApi(url: string) {
2526
2627export const PACKAGER_URL = 'https://webpack-dll-prod.herokuapp.com/v6' ;
2728export const NEW_PACKAGER_URL =
28- 'https://42qpdtykai .execute-api.eu-west-1.amazonaws.com/prod/package ' ;
29+ 'https://drq28qbjmc .execute-api.eu-west-1.amazonaws.com/prod/packages ' ;
2930
3031const RETRY_COUNT = 20 ;
3132
@@ -38,6 +39,7 @@ const RETRY_COUNT = 20;
3839async function requestPackager ( query : string ) {
3940 let retries = 0 ;
4041
42+ // eslint-disable-next-line no-constant-condition
4143 while ( true ) {
4244 debug ( `Trying to call packager for ${ retries } time` ) ;
4345 try {
@@ -72,12 +74,18 @@ async function requestPackager(query: string) {
7274async function callPackager ( dependencies : Object ) {
7375 const dependencyUrl = dependenciesToQuery ( dependencies ) ;
7476
75- // try {
76- // // Warmup cache
77- // window.fetch(`${NEW_PACKAGER_URL}/${dependencyUrl}`);
78- // } catch (e) {
79- // console.error(e);
80- // }
77+ try {
78+ // Warmup cache
79+ window . fetch ( `${ NEW_PACKAGER_URL } /${ dependencyUrl } ` ) . catch ( e => {
80+ if ( process . env . NODE_ENV === 'development' ) {
81+ console . error ( e ) ;
82+ } else {
83+ reportError ( e , { service : 'new-packager' } ) ;
84+ }
85+ } ) ;
86+ } catch ( e ) {
87+ console . error ( e ) ;
88+ }
8189
8290 const manifest = await requestPackager ( dependencyUrl ) ;
8391 return manifest ;
0 commit comments