We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a59b9b3 commit 368fc06Copy full SHA for 368fc06
packages/engine/src/modules.ts
@@ -87,12 +87,10 @@ export function createExecutionScope(context: TypeCellContext<any>) {
87
}
88
89
export function getModulesFromTypeCellCode(compiledCode: string, scope: any) {
90
- if (!compiledCode.match(/^(define\((".*", )?\[.*\], )function/gm)) {
+ // Checks if define([], function) like code is already present
91
+ if (!compiledCode.match(/(define\((".*", )?\[.*\], )function/gm)) {
92
// file is not a module (no exports). Create module-like code manually
- compiledCode = `define([], function() {
93
- ${compiledCode};
94
- });
95
- `;
+ compiledCode = `define([], function() { ${compiledCode}; });`;
96
97
98
if (Object.keys(scope).find((key) => !/^[a-zA-Z0-9_$]+$/.test(key))) {
0 commit comments