Skip to content

Commit 9ce2f9e

Browse files
committed
Fix generators
Fixes codesandbox#1169
1 parent 1d9db11 commit 9ce2f9e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

packages/app/src/sandbox/eval/loaders/dependency-resolver.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import DependencyNotFoundError from 'sandbox-hooks/errors/dependency-not-found-error';
22

3+
/**
4+
* We don't have fancy resolving for @babel/runtime because of optimalization,
5+
* so we try to alter it the best way we can.
6+
*/
7+
function alterBabelRuntimeDependencyPath(path: string) {
8+
if (path === '@babel/runtime/regenerator') {
9+
return '@babel/runtime/regenerator/index';
10+
}
11+
12+
return path;
13+
}
14+
315
/**
416
* Converts a dependency string to an actual dependency
517
*
@@ -10,7 +22,9 @@ import DependencyNotFoundError from 'sandbox-hooks/errors/dependency-not-found-e
1022
export default function getDependency(dependencyPath: string) {
1123
if (dependencyPath.startsWith('@babel/runtime/')) {
1224
// We have a precomputed bundle for this, since it's small anyway
13-
return require('./@babel-runtime.no-webpack')(dependencyPath);
25+
return require('./@babel-runtime.no-webpack')(
26+
alterBabelRuntimeDependencyPath(dependencyPath)
27+
);
1428
}
1529

1630
if (dependencyPath === 'codesandbox-api') {

0 commit comments

Comments
 (0)