Azure / Azure/fetch-event-source
Warning due to incomplete sourcemaps
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Description
## Description
The sourcemaps in the published package reference files that are not included in the published package.
When I use this package in my create-react-app project, I see the following warning:
```
WARNING in ./node_modules/@microsoft/fetch-event-source/lib/esm/fetch.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/[REDACTED]/node_modules/@microsoft/fetch-event-source/src/fetch.ts' file: Error: ENOENT: no such file or directory, open '/[REDACTED]/node_modules/@microsoft/fetch-event-source/src/fetch.ts'
```
`fetch.js` has `//# sourceMappingURL=fetch.js.map`. And `fetch.js.map` starts as follows:`{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAA`.
The `"sources":["../../src/fetch.ts"]` points to a file that doesn't exist in the package, which causes the warning to be emitted.
## Proposed solution
Either (a) include the src directory in the published package, or (b) update tsconfig to inline the ts file content using the [inlineSources](https://www.typescriptlang.org/tsconfig#inlineSources) option
## Steps to reproduce
1. Scaffold new app using create-react-app `npx create-react-app my-app`
2. `npm install --save @microsoft/fetch-event-source`
3. Add `import {fetchEventSource} from '@microsoft/fetch-event-source` to top of index.js
4. `npm run start`, warnings should show
Contributor guide
Assessment
This issue has not been assessed yet.