issue with source maps + typescript + including .ts files from a sibling workspace #4706
-
Hey! I have been testing out parcel 2 for a few months now, and it has been working pretty well for me. Recently tho, I needed to refactor some of my typescript code into other repository’s. This has changed many of my import paths to now be relative paths that sometimes reference into other workspaces. Since I am in an in-between state, I am not actually including these other workspaces as dependencies, but instead importing the ts source files directly using relative paths. So, afaik these files should all be discovered as parcel looks through the imports starting at the entry and properly compiled into the build including source maps. When using “parcel serve“ however, I see that the code is correctly compiled and bundled, except the source maps for ts files that are multiple directories up the file structure - those starting like “../../../“ - are incorrectly included. In Google Chrome, this manifests as the files showing up as sources, however not within the __parcel_source_root folder. Also, when clicking on one of these .ts files I am shown the contents of the entry file index.html. So, seemly the mapping is off. Right now, I have a work-around where I declare a second entry point as one of the .ts files whose source maps were off. This seems to fix the way the source maps are generated, as they all then show up as expected within the __parcel_source_root folder and the tooling works as expected. So, it’s not urgent that I get an answer to this, but I am trying to figure out what is causing this problem in the first place. It seems like since I’m including the .ts files directly by relative path they should correctly get source maps no matter where they are. But right now this is not what I’m seeing. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
I have encountered similar problem with missing source maps in #4699 and shown in the following sample project: https://github.com/gregid/rollup-lib-parcel-app |
Beta Was this translation helpful? Give feedback.
-
That sounds like Chrome is accessing a file the dev server isn't serving (and instead of 404, it returns the index - as common for SPA apps)
This is likely caused by these file being out of the project root (the directory with |
Beta Was this translation helpful? Give feedback.
That sounds like Chrome is accessing a file the dev server isn't serving (and instead of 404, it returns the index - as common for SPA apps)
This is likely caused by these file being out of the project root (the directory with
.git
or a lockfile):cc @DeMoorJasper