In StackBlitz it's possible to add another JS file(s) (besides index.js
) but it seems that only index.js
is actually being loaded. All the functions defined in other JS files created in the same (root) folder are just undefined
when I try to call them within the index.js
. I tried to 'activate' other files via HTML (<script src='./filename.js'>
tag) but it didn't help. What am I doing wrong?
Using several JS files in StackBlitz with a simple JS-project
Asked Answered
in index.js:
import {func} from './myscript.js';
In myscript.js:
exports.func = function(){...}
@CodyBugstein, like this: stackblitz.com/edit/svelte-imozn2?file=index.js –
Braddock
Can you also take a look at this question? #52899165 –
Rossen
(btw I cannot award bounty for another 21 hours, but I will asap) –
Rossen
I have tried this and worked for me.
In index.js add below statement
import "./myscript.js";
© 2022 - 2024 — McMap. All rights reserved.
myscript.js
insideindex.js
? – Rossen