• @allObjects Thank you, here I could achieve the solution:

    # create bundle
    BUNDLE="init.min.js"
    echo "" > ${BUNDLE}
    
    # Register modules via `Modules.addCached()` method
    # see: http://forum.espruino.com/comments/12899741/
    MODULE_NAME="FlashEEPROM"
    MODULE_STR=$(uglifyjs -c -m -- ${MODULE_NAME}.js | sed 's/\"/\\\"/g' | sed "s/\n//g")
    echo "Modules.addCached(\"${MODULE_NAME}\", \"${MODULE_STR}\");" >> ${BUNDLE}
    uglifyjs -c -m --  init.js >> ${BUNDLE}
    

    Now I can require("FlashEEPROM") as expected.

About

Avatar for ceremcem @ceremcem started