rotemdan / lzutf8.js

A high-performance Javascript string compression library
MIT License
322 stars 26 forks source link

Worker not found #22

Closed wormen closed 4 years ago

wormen commented 4 years ago

image

rotemdan commented 4 years ago

Hi, based on the output I'm assuming you're trying to consume the library in your own code (rather than compiling it by itself).

Seems like the typescript compiler is looking into the node_modules directory and finding the declaration file bundled with the build (it is auto-generated when the library is compiled) and erroring when it can't find a definition for the Worker interface.

If scanning the lzutf8 declaration file is not desired, I guess in tsconfig.json you can add:

    "exclude": [
        "node_modules"
    ]

If it is desired, than in your project's tsconfig.json try adding "webworker" under "lib":

"compilerOptions": {
    "lib": [
        "webworker"
    ]
},

Adding "dom" also seems to work (the library's tsconfig uses it).

An alternative is in the tsc command line add --lib webworker like this:

tsc --lib 'webworker'
wormen commented 4 years ago

yes it works thanks