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

Error when minify solid js #17

Closed
sirenkovladd opened this issue Jun 5, 2024 · 5 comments
Closed

Error when minify solid js #17

sirenkovladd opened this issue Jun 5, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@sirenkovladd
Copy link
Contributor

  • Version (npm -v): 10.5.2
  • Node Version node -v: v20.13.1
  • OS (uname -a on Linux): Darwin arm64

Small reproduce

import { minify } from "@putout/minify";

const source = `export function mergeProps() {
  let n = a();
  if (n) {
    n()
  }
  if (true) {
    const n = b();
    if (n) n();
  }
}`;
const result = minify(source);
TypeError: Cannot read properties of undefined (reading 'buildError')
    at e.value (~/node_modules/@putout/minify/bundle/minify.min.js:1:886385)
    at e.value (~/node_modules/@putout/minify/bundle/minify.min.js:1:890422)
    at e.value (~/node_modules/@putout/minify/bundle/minify.min.js:1:888346)
    at Object.Declaration (~/node_modules/@putout/minify/bundle/minify.min.js:1:881622)
    at e._call (~/node_modules/@putout/minify/bundle/minify.min.js:1:946995)
    at e.call (~/node_modules/@putout/minify/bundle/minify.min.js:1:946754)
    at e.visit2 [as visit] (~/node_modules/@putout/minify/bundle/minify.min.js:1:947999)
    at e.value (~/node_modules/@putout/minify/bundle/minify.min.js:1:978435)
    at e.value (~/node_modules/@putout/minify/bundle/minify.min.js:1:978023)
    at e.value (~/node_modules/@putout/minify/bundle/minify.min.js:1:978713) {
  loc: { line: 7, column: 4 },
  rule: 'minify/convert-const-to-var'
}
@coderaiser coderaiser added the bug Something isn't working label Jun 6, 2024
coderaiser added a commit to coderaiser/putout that referenced this issue Jun 6, 2024
@coderaiser
Copy link
Contributor

Just fixed in @putout/minify v3.15.0 🎉.

Is it works for you?

@sirenkovladd
Copy link
Contributor Author

sirenkovladd commented Jun 6, 2024

Now it's broken

import { minify } from "@putout/minify";

const source = `function on(e) {
  const r = Array.isArray(e);
  return r;
}
const DEV = void 0;
console.log({DEV,on});
`;

eval(source);
console.log('---');
const result = minify(source);
console.log(result);
eval(result);

here's the library I'm trying to minify
https://cdn.jsdelivr.net/npm/[email protected]/dist/solid.min.js

@coderaiser
Copy link
Contributor

Please provide code examples of what you receive and what you expect

@coderaiser
Copy link
Contributor

anded in v3.19.2 🎉. Is it works for you?

@sirenkovladd
Copy link
Contributor Author

Nice, thank you

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