Skip to content

Commit 8041b00

Browse files
committed
Improve regex
1 parent bd1f90b commit 8041b00

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/engine/src/modules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function createExecutionScope(context: TypeCellContext<any>) {
8888

8989
export function getModulesFromTypeCellCode(compiledCode: string, scope: any) {
9090
// Checks if define([], function) like code is already present
91-
if (!compiledCode.match(/(define\((".*", )?\[.*\], )function/gm)) {
91+
if (!compiledCode.match(/^\s+(define\((".*", )?\[.*\], )function/gm)) {
9292
// file is not a module (no exports). Create module-like code manually
9393
compiledCode = `define([], function() { ${compiledCode}; });`;
9494
}

0 commit comments

Comments
 (0)