Apologies if this is a duplicate question. I have been trying to look for similar questions for the past few days. Would be grateful if you could guide me to the duplicate question.
Question-
I am using a JS function inside a <script>
tag in a view/CSHTML
file.
I am trying to execute that function from another wwwroot/JS
file
Attempt
I would try ordering the JS scripts such that I add script tag for the javascript(which has my function) before consuming ones, but as the consuming one is actually a library that is used in the javascript(which has my function)
I tried export function function_name(){ ... }
and
import { function_name} from "../../Views/Home/FileName.cshtml";
This was unsuccessful because of ECMAScript level incompatibilities.
question from:
https://stackoverflow.com/questions/65924453/calling-js-function-from-a-cshtml-script-tag-in-another-wwwroot-js-file 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…