Problems using "require" with two script-tags

Viewed 19

I have a function loadDays() that should be called when my body section is loaded:

<body onload="loadDays()">

My loadDays() function looks like this:

<script>
    function loadDays() {  
        // Code
    }
</script>
      

Inside of loadDays() I need to access an excel-file.

So I added src="https://requirejs.org/docs/release/2.3.5/minified/require.js" to the <script> tag.

But then I recieved the following error:

Uncaught ReferenceError: loadDays is not defined at onload


Then someone gave me the hint to use two different <script> tags:

<script src="https://requirejs.org/docs/release/2.3.5/minified/require.js">
    const Excel = require('exceljs');
</script>

<script>
    function loadDays() {       
        // Code
    }
</script>

But now I have the problem that it says:

Uncaught ReferenceError: Excel is not defined at loadDays

How can I solve this issue?

1 Answers
Related