Fix source maps relative file lookup for source javascript file. #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We are using the ant-design-vue package with source maps, which depends on this package. During compilation there seem to be some problems with the source maps as generated with the compiled source.
The error is as follows:
I took a look at the source map that is generated by the closure compiler, which currently looks like:
From the source map spec I know that the
file
field should contain the name of the minified file, in this casemutationobserver.min.js
, however it seems closure compiler does not fill that.The main problem here is that the
sources
field should point to the original source file, relative to the source map file. As I'm unfamiliar with closure compiler and didn't see options to change thesources
to["../MutationObserver.js"]
, I've moved the minified file and the relevant source map to the same folder as the original javascript file. This seems a more future proof solution than manually adding the..
to the path, as the source map will still be correct after a recompile.P.S. I was unable to run the full test suite on
master
, it seemsgunit:main
is not able to run on my local machine. I didn't look into the cause of that, meaning it didn't run for my changes.