Parcel: Parcel doesn't always pickup source map file correctly

Created on 5 Jun 2020  ยท  13Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report

My current mono repo set up is as follows

- lib-dist
- lib-src
- app-dist
- app-src

where lib-dist is generated by rollup and app-dist is generated by parcel and has lib-dist as dependency

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

package.json script:

"app:start": "parcel app-src/index.html --out-dir app-dist",
"build:watch": "rollup --watch --config --sourcemap",

๐Ÿค” Expected Behavior

If I make change to app-src or lib-src and save, parcel should pick up changes and reload app in the browser with correct (updated) source map mapping

๐Ÿ˜ฏ Current Behavior

If I make change to app-src and save, parcel picks up changes and reloads app in the browser with correct (updated) source map mapping.

But if I make change only to lib-src and save - rollup saves lib-dist and parcel picks up changes for source code and reloads app in the browser but in 50% of cases the source map for the lib-dist will be incorrect i.e.: in console it will show the same line number of the same file, e.g. jquery.js:10873 (last line of jquery in this case) for every printed line

๐Ÿ’ Possible Solution

After making dummy change to app-src the lib-dist is correctly picked up. Since it only happens in about 50% of cases my guess is parcel picks up the source file before the source map is created by rollup.

๐Ÿ”ฆ Context

I need to make sure that I make some change to app-src every time I make change to lib-src for correctly debugging in browser console which is not ergonomic and time wasting.

๐Ÿ’ป Code Sample

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.12.4 & 2.0.0
| Node | v13.5.0
| npm/Yarn | 6.13.4
| rollup | 2.13.1
| Operating System | Win10x64

Bug Help Wanted โœจ Parcel 2

All 13 comments

I tried installing parcel2 and so far it seems it works correctly. Will see in the next few days if the problem appears.

Unfortunately with parcel2 (2.0.0-nightly.280) the problem is even bigger - it completely ignores source map for my rollup generated file.

EDIT: the same is happening with 2.0.0-alpha.3.2 so I must have missed this when I wrote previous reply.

I have created sample project showing the problem:
https://github.com/gregid/rollup-lib-parcel-app

Loading source maps from via sourceMappingURL of input assets isn't implemented yet for Parcel 2

@mischnic thanks for the update - is there any single place where current status of Parcel 2 (implementation wise) is so I wouldn't raise unnecessary issues in my further testing of parcel2?

issues in my further testing of parcel2?

No, keep them coming ๐Ÿ˜„

Q: Is this PR: #4813 on the roadmap to next release? Is my understanding correct it should address the issue?

@gregid it is, someone just needs to review it and then it should be on the next release

That's great, looking forward to testing it on nightly build once ready!

someone just needs to review it

And someone to fix CI ๐Ÿ˜‰

sorry to be PITA but I've noticed the CI has been fixed for few days now and I am checking the progress few times a day (I need it a lot) hoping tomorrow is the day I could use it on nightly build...

Other than failing to build on incorrect sourcemap URL #5031 the initial problem - randomly picking up external sourcemaps seems to be gone with the new PR, I will continue to test it a bit further and if it will continue to work will close this issue.

Haven't failed so far, closing the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidnagli picture davidnagli  ยท  3Comments

Niggler picture Niggler  ยท  3Comments

termhn picture termhn  ยท  3Comments

466023746 picture 466023746  ยท  3Comments

medhatdawoud picture medhatdawoud  ยท  3Comments