Hello,
I want to sort my code and put it in different files. I made a function in a new file and put it in my main file. But I get an error message.
Uncaught SyntaxError: export declarations may only appear at top level of a module [modelload.js:1]
Uncaught SyntaxError: import declarations may only appear at top level of a module
Dont´t wonder it is runnig on TYPO3
example Code:
modelload.js:
export function modelload(){
//some code
}
mainrender.js:
var createScene = function () {
//some code
import {modelload} from ‘./modelload.js’;
modelload();
//some code
}
My HTML:
<script src="/typo3conf/ext/alfavet_produktion/Resources/Public/JavaScript/Dist/DDD/modelload.js?1646120445"></script>
<script src="/typo3conf/ext/alfavet_produktion/Resources/Public/JavaScript/Dist/DDD/mainrender.js?1646120443"></script>
Thanks for the responses in advance.