Bug report about minifyJs in PosRestStore

In PopRestStore-> build.gradle, in task combineBaseJs ,The line

             destFile.append(file(it).getText("UTF-8"))

should be

            destFile.append(file(it).getText("UTF-8"), "UTF-8")

Otherwise on windows, the created combined.js file would be encoded in ANSI, then cause minifyCombined task fails with error:

PS D:\MoquiDemo-3.0.0> .\gradlew run

> Task :runtime:component:PopRestStore:minifyCombined
ERROR - [JSC_READ_ERROR] Cannot read file D:/MoquiDemo-3.0.0/runtime/component/PopRestStore/screen/store/components/combined.js: Failed to read: D:\MoquiDemo-3.0.0\runtime\component\PopRestStore\screen\store\components\combined.js, is this input UTF-8 encoded?

1 error(s), 0 warning(s)
Error: Cannot read file D:/MoquiDemo-3.0.0/runtime/component/PopRestStore/screen/store/components/combined.js: Failed to read: D:\MoquiDemo-3.0.0\runtime\component\PopRestStore\screen\store\components\combined.js, is this input UTF-8 encoded? at  line -1:-1
Js Minifier: 1 error(s), 0 warning(s)```

Have a nice day
1 Like

Thanks for reporting this, the code is similar in 2 places in the build.gradle file for the webroot component (in the moqui-runtime repo). I just pushed changes to PopRestStore and moqui-runtime based on your recommendation. I haven’t tested this on Windows, if you could do that it would be helpful.

1 Like

I got no problem with webroot component, only PopRestStore. I looked at the code in Webroot, did not have a clue of what make this difference.

Anyway, in PopRestStore, the code has been tested and it went ok without any errors.

Thanks .

1 Like

I got the same problem too on windows, just following the step:
git clone https://github.com/moqui/moqui-framework.git moqui
cd moqui
gradle getComponentSet -PcomponentSet=demo -PlocationType=release

  1. just open D:\MyProjects\moqui\runtime\component\PopRestStore\screen\store\components\combined.js this file, and change the encoding type to utf-8 and save successlly

  2. then run or load with following commands:
    gradle run
    or
    gradle load
    I have tried many times with the two steps, this file’s encoding will always be change to ANSI.

1 Like

Welcome to the forum!

According to this, does it work only after the change or does it work without modifications?

Are you sure you have the latest code? You can check the checksum is equal to a9a5a4f with git log --oneline in the PopRestStore branch.

If it doesn’t work without modification, and you have the time and skills a PR would be appreciated.

@strand this works fine. @michael I can’t see this branch, I test in master branch