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 option
Steps to reproduce
- Scaffold new app using create-react-app
npx create-react-app my-app
npm install --save @microsoft/fetch-event-source
- Add
import {fetchEventSource} from '@microsoft/fetch-event-source to top of index.js
npm run start, warnings should show
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:
fetch.jshas//# sourceMappingURL=fetch.js.map. Andfetch.js.mapstarts 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 option
Steps to reproduce
npx create-react-app my-appnpm install --save @microsoft/fetch-event-sourceimport {fetchEventSource} from '@microsoft/fetch-event-sourceto top of index.jsnpm run start, warnings should show