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

Support renamed destructured exports #175

Open
timfish opened this issue May 30, 2024 · 1 comment
Open

Support renamed destructured exports #175

timfish opened this issue May 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@timfish
Copy link

timfish commented May 30, 2024

const { init, parse } = require('es-module-lexer')

init.then(() => {
  const [imports, ex] = parse(`
const o = { name5: 1, name6: 1 }
export const { name5, name6: bar } = o`
  )
  console.log(imports, ex)
})

Outputs

[] [
  { s: 49, e: 54, ls: 49, le: 54, n: 'name5', ln: 'name5' },
  { s: 56, e: 61, ls: 56, le: 61, n: 'name6', ln: 'name6' }
]

But there should be a bar export instead of name6.

@guybedford
Copy link
Owner

Note the above should read:

[] [
  { s: 49, e: 54, ls: 49, le: 54, n: 'name5', ln: 'name5' },
  { s: 56, e: 61, ls: 56, le: 61, n: 'bar', ln: 'bar' }
]

@guybedford guybedford added the bug Something isn't working label Jun 1, 2024
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

2 participants