Skip to content

Cannot read property 'line' of null when generating sourcemaps #2738

@ross-pfahler

Description

@ross-pfahler

🐛 bug report

Trying to bundle a small project utilizing moment-range version 3.1.1 we receive an error when bundling during the step of sourcemaps.

A standalone repo to duplicate can be found at: https://github.com/ross-pfahler/parcel-sourcemap-bug

🎛 Configuration (.babelrc, package.json, cli command)

Minimal: parcel build index.js -o index.js

Deps include moment@^2.24.0 and moment-range@^3.1.1.

🤔 Expected Behavior

I would expect the build above to succeed.

😯 Current Behavior

$ parcel build index.js -o index.js
🚨  /Users/pfahler/dev/parcel-sourcemap-bug/node_modules/moment-range/dist/moment-range.js: Cannot read property 'line' of null
    at SourceMap.originalPositionFor (/Users/pfahler/dev/parcel-sourcemap-bug/node_modules/parcel-bundler/src/SourceMap.js:309:30)
    at extension.eachMapping.mapping (/Users/pfahler/dev/parcel-sourcemap-bug/node_modules/parcel-bundler/src/SourceMap.js:153:38)
    at Array.forEach (<anonymous>)
    at SourceMap.eachMapping (/Users/pfahler/dev/parcel-sourcemap-bug/node_modules/parcel-bundler/src/SourceMap.js:120:19)
    at SourceMap.extendSourceMap (/Users/pfahler/dev/parcel-sourcemap-bug/node_modules/parcel-bundler/src/SourceMap.js:152:15)
    at module.exports (/Users/pfahler/dev/parcel-sourcemap-bug/node_modules/parcel-bundler/src/transforms/terser.js:54:47)
    at <anonymous>
error Command failed with exit code 1.

💁 Possible Solution

Unsure

🔦 Context

Trying to build my project.

💻 Code Sample

https://github.com/ross-pfahler/parcel-sourcemap-bug

🌍 Your Environment

Software Version(s)
Parcel 1.12.0
Node 8.12.0
Yarn 1.13.0
Operating System osx

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions