Skip to content

Source map warnings due to missing TypeScript files in published package (from v3.7.0) #542

@prashantpm0

Description

@prashantpm0

After upgrading to react-zoom-pan-pinch@3.7.0, Webpack throws multiple warnings related to missing source files referenced in the .map files of the library.

The .js.map files included in the dist directory refer to .tsx and .ts source files that are not published with the npm package, causing source-map-loader to throw warnings during build.

To Reproduce
Steps to reproduce the behavior:

Install react-zoom-pan-pinch@3.7.0 in a TypeScript + Webpack project

Ensure source-map-loader is enabled in Webpack

Run npm start

See warnings like:

WARNING in ./node_modules/react-zoom-pan-pinch/dist/index.esm.js
Failed to parse source map from '.../node_modules/src/hooks/use-controls.tsx': ENOENT: no such file or directory
Expected behavior
The package should not include .map files that reference source files that do not exist in the published package. Either:

The .map files should be excluded from the npm package, or

The original source files should be included to allow proper source mapping

Node version: 18.x

Webpack version: 5.x

Additional context
This issue was not present in version 3.4.4. It appears to have started with the inclusion of .map files in the package from version 3.7.0.

Until resolved, this can be worked around by excluding the package in source-map-loader config:

Please consider fixing the package publishing configuration. Happy to help if needed.

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