Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module transform cannot export value extracted from default #2094

Open
kriskowal opened this issue Feb 21, 2024 · 0 comments
Open

Module transform cannot export value extracted from default #2094

kriskowal opened this issue Feb 21, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@kriskowal
Copy link
Member

kriskowal commented Feb 21, 2024

Describe the bug

Endo’s bundler cannot transform an ESM where an exported value was previously obtained from extraction of an object, where the default value was previously extracted. Or rather: this module can’t be bundled:

const { x, y = x } = z;
export { x, y };

Steps to reproduce

  1. In packages/module-source run the following failing tests:
test.failing('should support export of defaulted extraction', t => {
  new ModuleSource(`
    const { x, y = x } = globalThis;
    export { x, y };
  `)
});

test.failing('should support export const object with default', t => {
  const _ = new ModuleSource(`
    export const {
      x = undefined,
    } = globalThis;
  `);
  t.pass();
});

Expected behavior

Above test should pass and effect consistent behavior to other spec-compliant implementations.

Platform environment

Additional context

Screenshots

@kriskowal kriskowal added the bug Something isn't working label Feb 21, 2024
kriskowal added a commit that referenced this issue Oct 21, 2024
…2591)

Refs: #2094

## Description

Elaborates failing tests for a known defect of ModuleSource, encountered
in the development of #400
@kriskowal kriskowal self-assigned this Nov 16, 2024
erights added a commit that referenced this issue Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant