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

Flatten breaks function with invalid identifier name #89

Closed
MichaelXF opened this issue Jun 6, 2023 · 0 comments
Closed

Flatten breaks function with invalid identifier name #89

MichaelXF opened this issue Jun 6, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@MichaelXF
Copy link
Owner

Config and Small code sample

Config:

{
  target: "node",
  flatten: true
}

Code:

// Input
var object = {
  "my-function": function () {
    console.log("Success");
  },
};

object["my-function"](); // "Success"

// Output
var __p_6528915312_flat_my-function = function ([], [], __p_3339738254) {
    console['log']('Success');
    return __p_3339738254.fkgens5 = {};
};
var object = {
    'my-function': function () {
        var __p_3339738254 = {};
        __p_6528915312_flat_my-function([], [], __p_3339738254);
        if (__p_3339738254['fkgens5']) {
            return __p_3339738254['fkgens5']['YQwDJR'];
        }
    }
};
object['my-function']();

Expected behavior

The program should output "Success"

Actual behavior

SyntaxError: Unexpected token '-'
@MichaelXF MichaelXF added the bug Something isn't working label Jun 6, 2023
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