Awesome-qr.js icon indicating copy to clipboard operation
Awesome-qr.js copied to clipboard

Mismatched anonymous define() module

Open ncperng opened this issue 6 years ago • 3 comments

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

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?

ncperng avatar Apr 16 '18 08:04 ncperng

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

sumimakito avatar Apr 18 '18 14:04 sumimakito

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

SteMMo33 avatar Apr 23 '20 09:04 SteMMo33

Hi, I have the same problem on chrome.

city8208 avatar Nov 09 '20 16:11 city8208