You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ModuleSource cannot transform source code using default destructing.
// works
new ModuleSource(`const { a } = {a : 1}`);
// doesn't work
new ModuleSource(`const { a = 2 } = {a : 1}`);
// doesn't work also
new ModuleSource(`const [a = 1] = [];`);
Steps to reproduce
import { ModuleSource } from "@endo/module-source";
create new ModuleSource with a source code using default destructing
receive error:
SyntaxError: Error transforming source in <unknown>: Cannot read properties of undefined (reading 'buildError') (at transform-analyze.js:58:13)
at createStaticRecord (transform-analyze.js:58:13)
at new ModuleSource (module-source.js:86:7)
at app.tsx:33:15
at untrack (dev.js:518:12)
at Object.fn (dev.js:543:22)
at runComputation (dev.js:802:22)
at updateComputation (dev.js:780:3)
at runTop (dev.js:897:7)
at runUserEffects (dev.js:1011:36)
at dev.js:966:34Caused by: TypeError: Cannot read properties of undefined (reading 'buildError')
at NodePath.buildCodeFrameError (index.ts:141:21)
at collectPatternIdentifiers (babelPlugin.js:35:18)
at collectPatternIdentifiers (babelPlugin.js:23:14)
at babelPlugin.js:26:9
at Array.flatMap (<anonymous>)
at collectPatternIdentifiers (babelPlugin.js:25:33)
at babelPlugin.js:471:13
at Array.flatMap (<anonymous>)
at VariableDeclaration (babelPlugin.js:470:47)
at NodePath._call (context.ts:36:20)
Expected behavior
Can create a ModuleSource from source code using default destructing.
Question
Is this due to the behavior of the babel version we use?
This is a duplicate of #2094. My assumption is that this is a defect in our Babel transform that might even be straight-forward to fix. There are two test cases for this problem checked in with test.failing.
Describe the bug
ModuleSource cannot transform source code using default destructing.
Steps to reproduce
Expected behavior
Can create a ModuleSource from source code using default destructing.
Question
Platform environment
1.71.114 Chromium: 130.0.6723.58 (Official Build) (64-bit)
The text was updated successfully, but these errors were encountered: