@@ -7,39 +7,21 @@ import DependencyNotFoundError from '../../errors/dependency-not-found-error';
7
7
* @param {Object } externals
8
8
* @returns
9
9
*/
10
- export default function getDependency (
11
- dependencyPath : string ,
12
- externals : { [ key : string ] : string }
13
- ) {
14
- // This polyfill is included by default in the sandbox, no external dependency needed.
15
- // This is also included in CRA by default, so we keep compatability with
16
- // CRA.
17
- if ( dependencyPath . startsWith ( 'babel-runtime' ) ) {
18
- // eslint-disable-next-line global-require, import/no-dynamic-require
19
- return require ( `./babel-runtime${ dependencyPath . replace (
20
- 'babel-runtime' ,
21
- ''
22
- ) } `) ;
23
- }
10
+ export default function getDependency ( dependencyPath : string ) {
11
+ // // This polyfill is included by default in the sandbox, no external dependency needed.
12
+ // // This is also included in CRA by default, so we keep compatability with
13
+ // // CRA.
14
+ // if (dependencyPath.startsWith('babel-runtime')) {
15
+ // // eslint-disable-next-line global-require, import/no-dynamic-require
16
+ // return require(`./babel-runtime${dependencyPath.replace(
17
+ // 'babel-runtime',
18
+ // ''
19
+ // )}`);
20
+ // }
24
21
25
22
if ( dependencyPath === 'codesandbox-api' ) {
26
23
return require ( 'codesandbox-api' ) ;
27
24
}
28
- const dependencyModule =
29
- externals [ dependencyPath ] || externals [ `${ dependencyPath } .js` ] ;
30
- if ( dependencyModule ) {
31
- const idMatch = dependencyModule . match ( / d l l _ b u n d l e \( ( \d + ) \) / ) ;
32
- if ( idMatch && idMatch [ 1 ] ) {
33
- try {
34
- return window . dll_bundle ( idMatch [ 1 ] ) ;
35
- } catch ( e ) {
36
- if ( window . dll_bundle ) {
37
- // Delete the cache of the throwing dependency
38
- delete window . dll_bundle . c [ idMatch [ 1 ] ] ;
39
- }
40
- throw e ;
41
- }
42
- }
43
- }
25
+
44
26
throw new DependencyNotFoundError ( dependencyPath ) ;
45
27
}
0 commit comments