anandthakker / doiuse

:bomb: Lint CSS for browser support against caniuse database.
MIT License
1.23k stars 50 forks source link

fix: Fix transform stream example #162

Closed regseb closed 1 year ago

regseb commented 1 year ago

With As a transform stream example in README, I have this error:

/home/regseb/testcase/index.js:4
  .pipe(doiuse({ browsers: ['ie >= 8', '> 1%'], ignore: ['rem'] }))
        ^

TypeError: Class constructor CssUsageDuplex cannot be invoked without 'new'
    at Object.<anonymous> (/home/regseb/testcase/index.js:4:9)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.16.1
clshortfuse commented 1 year ago

I don't think that's the issue you're seeing. It works with require(). I think your issue already been solved with ab7df2f but I would have to see more code to confirm.

If you look at the stack trace it's saying CssUsageDuplex needs to be constructed, not DoIUse.

clshortfuse commented 1 year ago

Actually, the issue is valid but the fix isn't to rewrite the docs, but to fix the CJS export to match the docs.

clshortfuse commented 1 year ago

Fixed by 959d763

Try using v6.0.1