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

Trying to create a bug reproduction but running into InvalidArg #714

Closed
danieltroger opened this issue Apr 9, 2024 · 2 comments
Closed

Comments

@danieltroger
Copy link

Hi, I have a bug where lightningcss completely removes this declaration from the output:

.depict.plp .filters .body .input-row,
.depict.plp .filters .body .input-row > .left {
  align-items: center;
  display: flex;
}

If

targets: { ios_saf: 16 },

is set. I wanted to create a minimal reproduction for it, but even the most minimal reproduction to get lightningcss to run gives me an inexplicable "InvalidArg" error that doesn't seem to come from JS code?

/private/tmp/repro/index.js:4
const code = transform({
             ^

Error
    at Object.<anonymous> (/private/tmp/repro/index.js:4:14)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Module._load (node:internal/modules/cjs/loader:1021:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'InvalidArg'
}

Node.js v21.7.2

To reproduce that error, download repro.zip and then run npm install && node index.js.

As for the original issue, I only managed to reproduce it in the web REPL when setting the required safar version to 1, but maybe that's enough for you to debug? The declaration that disappears is this style rule:

.depict.plp .filters .body .input-row > .left {
  align-items: center;
  display: flex;
}

REPL link

@devongovett
Copy link
Member

code needs to be a Buffer not a string. So you could use Buffer.from('body{color:red}')

@danieltroger
Copy link
Author

Thank you, opened #738

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

No branches or pull requests

2 participants