'Import a JavaScript file into another JavaScript file that is imported into another file

I need to import a file that imports code from another file and then import that file into a final file that adds code to an HTML button. How can I do this? When I try with the following example below no code runs.

// file 1
export function someFunction() {
    // more code
}

// file 2
import {someFunction} from './file1';
export function otherFunction() {
    someFunction();
    // more code
}

// file 3
import {otherFunction} from './file2';
document.getElementById('some-button').onclick = otherFunction;

// in index.html 
<script type='module' src='./file3.js'></script>


Solution 1:[1]

The solution is to have all the files be included in the index.html as type="module"

<script type='module' src='./file1.js'></script>
<script type='module' src='./file2.js'></script>
<script type='module' src='./file3.js'></script>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jalrux