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

Can't export when enumerable is "!0" #64

Open
zhoukekestar opened this issue Oct 21, 2021 · 0 comments
Open

Can't export when enumerable is "!0" #64

zhoukekestar opened this issue Oct 21, 2021 · 0 comments
Labels
edge case wontfix This will not be worked on

Comments

@zhoukekestar
Copy link

zhoukekestar commented Oct 21, 2021

Input File:

Object.defineProperty(exports, 'a', {
  enumerable: true,
  value: 'a'
});

Object.defineProperty(exports, 'b', {
  enumerable: !0,
  value: 'b'
});

Expected Result: ["a", "b"]
Actual Result: ["a"]

We can get this case when we use uglifyjs to minify our source code.
image

The Error is occured in https://github.com/guybedford/cjs-module-lexer/blob/a96e7b52b99d39fee25d69f356905161d14a15ed/lexer.js#L370

Here is a simple solution:

          if (source.startsWith('true', pos)) {
            pos += 4;
          } else if (source.startsWith('!0', pos)) {
            pos += 2;
          } else {
            break;
          }
zhoukekestar added a commit to zhoukekestar/cjs-module-lexer that referenced this issue Oct 21, 2021
@guybedford guybedford added enhancement New feature or request edge case wontfix This will not be worked on and removed enhancement New feature or request labels Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
edge case wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants