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

Do not minify (mangle) identifiers in bundle #271

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

joliss
Copy link
Contributor

@joliss joliss commented Mar 2, 2024

Without this, we get the following in dist/index.js:

const x1 = {
  0: "Unexpected token",
  // ...
};
class I2 extends SyntaxError {
  constructor(i, n, e, t, ...o) {
    const l = "[" + n + ":" + e + "]: " + x1[t].replace(/%(\d+)/g, (f, c) => o[c]);
    super(`${l}`), this.index = i, this.line = n, this.column = e, this.description = l, this.loc = {
      line: n,
      column: e
    };
  }
}

With this change, we get

const errorMessages = {
  0: "Unexpected token",
  // ...
};
class ParseError extends SyntaxError {
  constructor(startindex, line, column, type, ...params) {
    const message = "[" + line + ":" + column + "]: " + errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
    super(`${message}`), this.index = startindex, this.line = line, this.column = column, this.description = message, this.loc = {
      line,
      column
    };
  }
}

This should make for better error messages, as we aren't limited by bandwidth in Node.

@borisdiakur borisdiakur merged commit fc2749a into borisdiakur:main Mar 3, 2024
2 checks passed
@joliss joliss deleted the no-minify branch March 6, 2024 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants