So, I am writing an application with the node/express + jade combo.
I have client.js
, which is loaded on the client. In that file I have code that calls
ES6: In html include main js file using attribute type="module"
(browser support):
And in script.js
file include another file like that:
import { hello } from './module.js';
...
// alert(hello());
Inside included file (module.js
) you must export function/class that you will import
export function hello() {
return "Hello World";
}
Working example here. More info here