Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ross-pfahler opened this issue Mar 7, 2019 · 4 comments 路 Fixed by #2748
Closed

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

ross-pfahler opened this issue Mar 7, 2019 · 4 comments 路 Fixed by #2748

Comments

@ross-pfahler
Copy link

ross-pfahler commented Mar 7, 2019

馃悰 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
@mischnic
Copy link
Member

mischnic commented Mar 7, 2019

@DeMoorJasper This happens since your PR #2149.
The original position for { line: 13, column: 16 } is requested and originalPositionFor fails. Visualization of file

@DeMoorJasper
Copy link
Member

Thanks @mischnic for tracking down the cause of this bug.
I'll try to fix it and open up a PR in a bit.

@DeMoorJasper DeMoorJasper self-assigned this Mar 8, 2019
@ross-pfahler
Copy link
Author

thanks @DeMoorJasper!

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Mar 8, 2019

Seems like this would likely break any project having null mappings in node_modules, should have probably tested that in my PR.

Anyways bugfix is here: #2748 馃帀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants