ide / await-lock

Mutex locks for async functions
MIT License
89 stars 12 forks source link

Source map resolution failure #23

Closed pmg23 closed 2 years ago

pmg23 commented 2 years ago

I see the following warning/error at build time when using await-lock in my project:

WARNING in ./node_modules/await-lock/build/AwaitLock.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from 'D:\src\MyProject\node_modules\await-lock\src\AwaitLock.ts' file: Error: ENOENT: no such file or directory, open 'D:\src\gui\MyProject\node_modules\await-lock\src\AwaitLock.ts'

It's a TypeScript project based on Create React App (preconfigured WebPack); package.json contains:

{
    "dependencies": {
        "await-lock": "^2.2.1"
        "react-scripts": "^5.0.0",
        "typescript": "~4.5.4",
        // ...
    }
    // ...
}

I note that the node package consists of:

image

and AwaitLock.js.map contains (reformatted):

  "file": "AwaitLock.js",
  "sourceRoot": "",
  "sources": [
    "../src/AwaitLock.ts"
  ],

If I understand it correctly the error occurs because the source map refers to a file AwaitLock.ts which is not included in the package. Assuming that is the case please could you include it, to eliminate the dangling reference?

Thanks for sharing this useful library. Regards, Matt

pmg23 commented 2 years ago

Confirmed that your change (in v2.2.2) fixes the problem for me. Thanks for the fast turnaround.