Closed arve0 closed 5 years ago
I get same results in 1.4.0 and 1.5.0:
C:\Temp\sme>source-map-explorer --version
1.5.0
C:\Temp\sme>source-map-explorer main.*
File not found! -- ENOENT: no such file or directory, open 'main.*'
C:\Temp\sme>source-map-explorer --version
1.4.0
C:\Temp\sme>source-map-explorer main.*
File not found! -- ENOENT: no such file or directory, open 'main.*'
For reference, glob was originally verified in https://github.com/facebook/create-react-app/issues/2717
After debugging, I see that glob is only working when it also matches .map file. For example:
main.*.js*
, ending star will make it match both filesCode: https://github.com/danvk/source-map-explorer/blob/master/index.js#L203
This is a bit unintuitive, as <script.map.js>
is an optional parameter.
Proposed fix:
A. If .map is not given, shim as args['<script.js>'] + ".map"
and glob for each of them.
B. Fail hard when it does not match exactly two files: https://github.com/danvk/source-map-explorer/blob/master/index.js#L200
C. Add trailing star to glob if it does only match one file.
D. If it matches one file, see if match + ".map" exists.
Let me know what you prefer, and I'll send a PR.
Edit: Added option D.
No response on comment yet, so opening an issue.
Has anything changed in 1.6.0? Cannot get globs to work: