Unable to use CLI
MichaelCurrin opened this issue · 9 comments
Hi, can you make a fix for the CLI or provide doc changes to explain what I need to do?
I have a file which does indeed exist.
$ ls
bundle.js
If I run the minifier tool against it, it cannot find it.
Using docs suggestion.
deno install --allow-read --allow-write --allow-hrtime -n minifier https://deno.land/x/minifier/cli.ts
minifier build/bundle.js
Output:
error: Uncaught (in promise) RuntimeError: unreachable
at <anonymous> (<anonymous>:0:336402)
at <anonymous> (<anonymous>:0:341095)
at <anonymous> (<anonymous>:0:339418)
at <anonymous> (<anonymous>:0:339780)
at <anonymous> (<anonymous>:0:336271)
at <anonymous> (<anonymous>:0:268320)
at minify (<anonymous>:0:253182)
at minify (https://deno.land/x/minifier@v1.1.1/wasm.js:98:14)
at minify (https://deno.land/x/minifier@v1.1.1/mod.ts:27:10)
at https://deno.land/x/minifier@v1.1.1/cli.ts:53:3
Sorry may be a duplicate of #1
Using HTML works
minifier index.html✅ Successfully minified index.html! (134ms)
The first item in the command is the location of the file; and the second (optional) item is the output location. However, you must ensure that directories are made before trying to write into that as it is not guaranteed by Deno.writeFile
.
Thanks but I already tried with 2 args.
minifier bundle.js min.js
error: Uncaught (in promise) RuntimeError: unreachable
at <anonymous> (<anonymous>:0:336402)
at <anonymous> (<anonymous>:0:341095)
at <anonymous> (<anonymous>:0:339418)
at <anonymous> (<anonymous>:0:339780)
at <anonymous> (<anonymous>:0:336271)
at <anonymous> (<anonymous>:0:268320)
at minify (<anonymous>:0:253182)
at minify (https://deno.land/x/minifier@v1.1.1/wasm.js:98:14)
at minify (https://deno.land/x/minifier@v1.1.1/mod.ts:27:10)
at https://deno.land/x/minifier@v1.1.1/cli.ts:53:3
Hmmm, looks to be a problem with the minifying. What is in your file?
The directories do exist. The one I ran above is within build/
where ./bundle.js
is at the location and the output will be at the same dir location ./out.js
.
I'm going to assume that this is from #1 due to the contents not matching what esbuild thought it was.
It is plain JS and contains React code bundled as a single 21k line file
I tried with console.log()
and nothing else in the file and minifier worked. So yes it is something in my script. And not a duplicate because JS bundling does work - just sometimes not