`RuntimeError: unreachable` caused by string literal or comment containing `</`
yw662 opened this issue · 1 comments
yw662 commented
It is tested with :
const minifier = import('https://deno.land/x/minifier/mod.ts')
minifier.minify('js', Deno.readTextFileSync(${file_path}))
Firstly I tried this:
const a = 1
And it gives, as expected, "const a = 1"
However for this one:
//</
const a = 1
It crashes with RuntimeError: unreachable
:
Uncaught RuntimeError: unreachable
at <anonymous> (<anonymous>:1:336424)
at <anonymous> (<anonymous>:1:341096)
at <anonymous> (<anonymous>:1:339419)
at <anonymous> (<anonymous>:1:339781)
at <anonymous> (<anonymous>:1:336272)
at <anonymous> (<anonymous>:1:268321)
at minify (<anonymous>:1:253183)
at minify (https://deno.land/x/minifier@v1.1.1/wasm.js:98:14)
at Module.minify (https://deno.land/x/minifier@v1.1.1/mod.ts:27:10)
at <anonymous>:2:10
And (not) surprisingly these also fail:
const a = '</'
and,
const a = '</div>'
with the same RuntimeError: unreachable
,
but these are good:
const a = '<div></div>'
or this:
const a = '<'
I am on Apple M1 device and deno 1.8.0
.
yw662 commented
Just found a workaround for that:
minifier.minifyHTML(`<script>${code}</script>`, {minifyJS: true}).slice(8, -9)
Will do a PR if you are glad with that
Well this doesn't seem to minify the code. Will try some other ways.