g0t4 / webpack-stats-graph

Generate a graph to visualize modules and bundles from webpack via stats.json
MIT License
32 stars 18 forks source link

dot command fails if spaces in path #1

Open jrvjrv opened 6 years ago

jrvjrv commented 6 years ago

I am running ubuntu in a bash command prompt.

I modified line 139 of index.js by adding double quotes. There may be a more general way to quote the parameters to cover more exotic problems, but for my purposes double-quoting was enough.

const render = shell.exec(`dot -Tsvg -o "${svgFile}" "${dotFile}"`);
DmitryNaimark commented 6 years ago

I have also experienced this(on Windows), also had a space in one of the parent folders of the project.

After executing:

webpack-stats-graph

I got:

Writing files to statsgraph
Error: dot: option -  unrecognized

Usage: dot [-Vv?] [-(GNE)name=val] [-(KTlso)<val>] <dot files>
. . .

Changing node_modules/webpack-stats-graph/index.js line 139 from

const render = shell.exec(`dot -Tsvg -o ${svgFile} ${dotFile}`);

to

const render = shell.exec(`dot -Tsvg -o "${svgFile}" "${dotFile}"`);

also fixed the issue for me.