jimp-dev / jimp-dev/jimp

Failed to parse sourcemap when bundling with webpack

Open
#1,353 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14.7k
Forks
777
PR merge metrics
No merged PRs in 30d

Description

# Expected Behavior

Source map can be correctly parsed by bundlers.

# Current Behavior

Webpack@5.95.0 fails to parse source maps, throws the following error:

```
Failed to parse source map from '/path/to/project/node_modules/jimp/src/index.ts' file: Error: ENOENT: no such file or directory, open '/path/to/project/node_modules/jimp/src/index.ts'
```

# Failure Information (for bugs)

Jimp only exports the `dist` folder to npm, however the `index.js.map` has a direct reference to the `src/index.ts`, which is not included on npm:

```
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[], ...}
```

the source file loader then tries to parse the `sources` array, but since it's missing, it throws a ENOENT

## Steps to Reproduce

1. import jimp into a file
2. try to bundle with a barebones webpack config

**Screenshots**

## Context

- Jimp Version: 1.6.0
- Operating System: MacOS Ventura 13.3
- Node version: 20.18

## Failure Logs

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.