readium-shared-js
readium-shared-js copied to clipboard
Uncaught Error: See almond README: incorrect module build, no module name
This issue is a Question
I have difficulties to update the Readium package embedded in an Android application. First, the application embeds the version 0.17 of the readium-shared-js lib. Because of the issue #398, I want to upgrade this package to the last version, ie. 0.27. I'm not a JS developer and I notice that the code architecture has changed; So, it's difficult for me to correctly do the migration. When I want to display an ePub inside my webview, I've got errors in my console linked to the almond module (see the observed module part). Regarding the almong README, it means that there is a define()'d module, but it is missing a name. But, as far as I understand, some file in the shared-js lib in the js are not complaint with this rule. For example: globalsSetup.js, globals.js, helpers.js, plungins_controller.js, some files in the views package, some in the models package, etc.
If it can help, I'm using the single bundle of readium-shared-js:
<!-- main code bundle, which includes its own Almond AMD loader (no need for the full RequireJS library) -->
<script src="shared-js/build-output/single-bundle/readium-shared-js_all.js"
type="text/javascript"></script>
Is it something i've missed?
Thanks for advice.
Related issue(s) and/or pull request(s)
See also #398
Observed behaviour
"Uncaught Error: See almond README: incorrect module build, no module name", source: file:[...]/shared-js/build-output/single-bundle/readium-shared-js_all.js (414)
Product
- ePub reader Android application which use readium shared-js and android readium sdk
Hello, first of all, good idea to use the "single bundle", at least to test your Android integration. I strongly suggest you try the default build from the develop branch, just to check that your app works: https://github.com/readium/readium-shared-js/tree/develop/build-output/_single-bundle
Right now, the default build of the single bundle contains the Hypothes.is plugin, which you do not need in your app (as it really is designed just for web / cloud readers). So, you would have to either:
(1) create your own "single bundle" build of readium-shared-js ( documentation: https://github.com/readium/readium-shared-js/blob/develop/README.md#prerequisites )
or
(2) reference a selected set of "multiple bundles" (simply exclude the Hypthes.is one): https://github.com/readium/readium-shared-js/tree/develop/build-output/_multiple-bundles
Let us know how it goes! Thanks!
Hello Daniel, Thanks for advice. I've done the following with the same error:
- checkout the default build from the develop branch
- build my own single bundle
I've tried to use the multiple bundle. But I have some other errors:
- Uncaught ReferenceError: ReadiumSDK is not defined
- Uncaught TypeError: Cannot read property 'ReaderView' of undefined
- Uncaught Error: Mismatched anonymous define() module: function (Globals, _, $, JQuerySizes, SpineItem) (followed by the code of a method of the globalsSetup.js)
I don't know what todo..Trying to update version by version?
How does your code compare with: https://github.com/readium/SDKLauncher-Android/blob/develop/SDKLauncher-Android/app/src/main/assets/readium-shared-js/reader.html#L4 ? (this works just fine in the default ReadiumSDK "launcher app" for Android)