-
Notifications
You must be signed in to change notification settings - Fork 17
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File System Paths in sources
#44
Comments
In Chrome, we have struggled with several issues around source paths:
|
I have been exploring how Babel handles this, and it is... terrible. Apparently we just put the filename in |
I would be super curious if there is some sort of best practice at the moment. |
This relates to the conversation about
sources
from #42. There is something curious going on withsources
today in practice and it relates to how filenames and URLs are handled. An entry insources
is relative to the source map and the source map is relative to the transpiled javascript file. This makes sense, but in practice you will see that people stash actual file names intosources
which are not on the same "namespace" or "origin" as the script.Specifically in theory you can have
https://foo.invalid/app/whatever.js
as the minified file, then that refers towhatever.js.map
which contains asources
entry calledwhatever.js
which however is not the generatedwhatever.js
but the originalwhatever.js
(before minification). Strict reading of the specification says that this is illegal. In fact, quite a bit of tooling relies on the fact that source files are in fact placed somewhere on the same URL namespace so they can be fetched, but in practice it just happens that source refer to paths as they were on the file system originally. Some tools emitwebpack://foo
or similar to "move" files into a separate independent namespace, but I have also seen tools throw things like/path/to/builder
into the structure. On Windows I have even see drive letters pop up which are definitely not valid URLs.One effect can also be that the path moves past the URL root. I have seen a source map at
/dist/foo.map
which itself contains sources that are at../../../node_modules/foo.js
.I'm not sure if this particularly actionable, but maybe there should be some guidances around what is acceptable and what is not.
The text was updated successfully, but these errors were encountered: