I spent a little more time in Python and there, importing from another file just takes a
from file import functionName Is export required in Javascript when importing? I would like to split my single file into several different ones as it becomes more and more difficult to read. There should be only one function in each of the additional files. When I tried to import these extra files just by import {functionName} from './modules/filename.js' then I was getting Uncaught SyntaxError: The requested module './modules/filename.js' does not provide an export named 'functionName', but when I added when I wrote export before the function like export function functionName() {}, everything works fine. Do I understand correctly that in JS, import always requires export?
>Solution :
Your JS file is a module and you need to specify what will be exposed by this module:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
You could create a library where you do not want to expose all internal methods but only some of them and you can achieve that with the export keyword.