HTML5 Build fails when using extension-iap library: ReferenceError: addToLibrary is not defined

Hello everyone, hope you all are doing fine!

I am trying to build my project for HTML5 but I am getting the following error:

error: failure to execute js library "/tmp/job17685201180918059174/upload/extension-iap/lib/web/library_facebook_iap.js": ReferenceError: addToLibrary is not defined,
error: use -s VERBOSE to see more details
Internal compiler error in src/compiler.js!
Please create a bug report at https://github.com/emscripten-core/emscripten/issues/
with a log of the build and the input files used to run. Exception message: "ReferenceError: addToLibrary is not defined" | ReferenceError: addToLibrary is not defined
    at eval (eval at load (eval at load (/opt/platformsdk/emsdk-2.0.11/upstream/emscripten/src/compiler.js:38:8)), <anonymous>:169:1)
    at Object.load (eval at load (/opt/platformsdk/emsdk-2.0.11/upstream/emscripten/src/compiler.js:38:8), <anonymous>:190:9)
    at JSify (eval at load (/opt/platformsdk/emsdk-2.0.11/upstream/emscripten/src/compiler.js:38:8), <anonymous>:75:20)
    at Object.<anonymous> (/opt/platformsdk/emsdk-2.0.11/upstream/emscripten/src/compiler.js:98:3)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
em++: error: '/opt/platformsdk/emsdk-2.0.11/node/12.18.1_64bit/bin/node /opt/platformsdk/emsdk-2.0.11/upstream/emscripten/src/compiler.js /tmp/tmp89_5kqwt.txt' failed (1)
com.defold.extender.ExtenderException: java.io.IOException: error: failure to execute js library "/tmp/job17685201180918059174/upload/extension-iap/lib/web/library_facebook_iap.js": ReferenceError: addToLibrary is not defined,

When I remove the extension-iap library it builds successfully

Does anyone have same issue? Any help will be appreciated!

Defold version: 1.7.1
extension-iap version: 5.1.1

What if you try the previous version of the extension? (https://github.com/defold/extension-iap/archive/refs/tags/5.1.0.zip)

Thank you a lot, downgrading the extension-iap for 5.1.0 fixed the problem.
Is that a breaking change I will need to be aware for next updates?

A quick correction, my Defold version is: 1.7.0

The extension internals were updated in 5.1.1 to support some changes in Defold 1.7.1. You shouldn’t have to make any changes to your code whenever you update to Defold 1.7.1 besides updating the extension back to 5.1.1.

1 Like

Defold 1.7.0 is not compatible with extension version 5.1.1. The release notes for extension-iap states that version 5.1.1 was “Updated to be compatible with Defold 1.7.1 and the new Emscripten version.”

1 Like