danvk / source-map-explorer

Analyze and debug space usage through source maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expand globs

gaearon opened this issue · comments

commented

Currently it seems like the program doesn't expand globs itself. This makes it impossible to run something like source-map-explorer build/static/js/main.* on Windows and get it to pick up a hashed filename. Which makes it hard to put into package.json as one of the scripts because the built filename is different every time.

It would be great if source-map-explorer could expand globs (it's fine to enforce it only expands to a single file) for this particular use case on Windows.

Hi @gaearon! What would you expect the output of source-map-explorer to be with a glob input? Are you expecting build/static/js/main.* to expand to build/static/js/main.js build/static/js/main.js.map or to include multiple bundles? If it's the former, I'm surprised that your shell isn't handling this.

commented

The goal is to match main.js.somelongrandomhash.js and main.js.somelongrandomhash.js.map. The hash is different on every build.

Windows shells don't have any expansion at all. They just pass what you typed.

Makes sense. I'd happily merge a PR to do this, or I can take a crack at it myself soon.

commented

Awesome! I probably won't have time to dive into it but if you can't find time either, let me know and I can create an issue in create-react-app asking someone to contribute this. Since we now link to this tool from the documentation.

@gaearon I merged a fix for this and cut a 1.4.0 release. Let me know if this works for you.

Has anything changed in 1.6.0? Cannot get globs to work:

C:\Temp\sme>npm i -g source-map-explorer
C:\Users\_\AppData\Roaming\npm\source-map-explorer -> C:\Users\_\AppDa
ta\Roaming\npm\node_modules\source-map-explorer\index.js
+ source-map-explorer@1.6.0
updated 1 package in 0.957s

C:\Temp\sme>source-map-explorer --version
1.6.0

C:\Temp\sme>source-map-explorer main.*
File not found! --  ENOENT: no such file or directory, open 'main.*'

C:\Temp\sme>dir main.*
 Volumet i stasjon C er OSDisk
 Volumserienummeret er F65B-C808

 Innhold i C:\Temp\sme

11.01.2019  08:36             2 146 main.js
               1 fil(er)            2 146 byte
               0 mappe(r)   9 305 964 544 byte ledig

C:\Temp\sme>