Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: See almond README: incorrect module build, no module name #415

Open
BrunoAndroidDev opened this issue Oct 3, 2017 · 3 comments

Comments

@BrunoAndroidDev
Copy link

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
@danielweck
Copy link
Member

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!

@BrunoAndroidDev
Copy link
Author

BrunoAndroidDev commented Oct 4, 2017

Hello Daniel,
Thanks for advice.
I've done the following with the same error:

  1. checkout the default build from the develop branch
  2. 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?

@danielweck
Copy link
Member

danielweck commented Oct 4, 2017

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants