Skip to content

Warning due to incomplete sourcemaps #18

@schnerd

Description

@schnerd

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

  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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions