sumimakito/Awesome-qr.js

Mismatched anonymous define() module

ncperng opened this issue · 3 comments

Thanks for this awesome project. I would like to use it on front-end browser side with

<script src="/javascripts/awesome-qr/require.js"></script>

Unfortunately I got "Uncaught Error: Mismatched anonymous define() module" in File require.js. This error issued while I only include the script, without any further javascript code.

I've both installed awesome-qr with

  1. npm install, and then copy out the /dist
  2. directly download from GitHub

It definitely is my misunderstanding of the usage of this package. It is possible to give me a clue to solve my problem?

Hi ncperng,

Sorry for the late reply.
I have tried with the following minimal test case:

<img id="qrcode" width="200" height="200">
<script type="text/javascript" src="js/require.js"></script>
<script>
        var __awesome_qr_base_path = "js";
        require([__awesome_qr_base_path+'/awesome-qr'], function(AwesomeQR) {
            AwesomeQR.create({
                text: 'Makito loves Kafuu Chino.',
                size: 800,
                margin: 20,
                bindElement: 'qrcode'
            });
        });
</script>

... but I failed to reproduce the same exception and it turned out that the script worked smoothly.

In this test case, the file structure of the website's root looks like:

index.html
js/
 |- require.js
 |- other scripts

As you have mentioned the define(), I am not sure whether or not the exception was caused by require.js itself.

Makito

Same problem for me.
I'm using the js files from Chrome browser (no node); the files are hosted in js folder.
Anyone solved?
Is there some dependencies from node?

Thanks

Hi, I have the same problem on chrome.