I have a ‘marker_clustering.js’ file in ‘assets/vendor’ directory.
This file defines a constructor function called MarkerClustering and has an export default MarkerClustering
directive.
In the ‘app.js’ file, there is an import MarkerClustering from "../vendor/marker_clustering"
declaration.
In the ‘root.html.heex’ file, load the ‘app.js’ file as follows:
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"} />
In the above situation, if you use the ‘MarkerClustering constructor’ in the script tag of the ‘home.html.heex’ file, the following error will appear in the browser console:
Uncaught ReferenceError: MarkerClustering is not defined
Even if I assign MarkerClustering to windows.MarkerClustering, this problem is not solved.
I wonder what to do in this case.