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
Add sourcemapBaseUrl option #4527
Add sourcemapBaseUrl option #4527
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4527 +/- ##
=======================================
Coverage 98.86% 98.87%
=======================================
Files 208 209 +1
Lines 7334 7346 +12
Branches 2095 2098 +3
=======================================
+ Hits 7251 7263 +12
Misses 27 27
Partials 56 56
Continue to review full report at Codecov.
|
1d7097f
to
81dde77
Compare
@@ -0,0 +1,8 @@ | |||
export function isValidUrl(url: string): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure where I should add tests for functions like these. It looks like all of the tests in the project are end-to-end tests and do not import typescript code from src
. @lukastaegert I'd be happy to open a separate PR adding unit tests that execute with mocha -r ts-node/register
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, please don't. Then we would still need a test that actually uses the option, i.e. an E2E test. I mean that is the point, to test the effect of this option. As e2e tests in Rollup are REALLY fast, there is really no point in writing unit tests that need to be adapted with every refactoring.
A very simple way could be to add a chunking-form test because those tests just snapshot the output directory and that would include the source map. Or you add a sourcemap test, those tests pass you the source map and you make assertions on the generated map. If all else fails, I will need to look into writing a test myself.
I took the liberty to add a test for the bad case, which also prompted me to improve the error message a little. I also added some documentation for the option itself and shortened the CLI printout to match the 80 character line-break we use in that file. Otherwise, this is really high quality work and I plan to merge it once everything is green. |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
This feature can be useful for when sourcemaps need to be loaded through a different URL to the one where the bundled code is loaded from.
It would be the equivalent of the
publicPath
option in Webpack's source-map-dev-tool pluginThe use case would be to source my organisation's sourcemaps in a server within our internal network to prevent exposing the source code on production.
If this is something of interest then the following features could also be considered:
sources
field inside of *.map files)