I have a simple structure and would like to utilize assets from cdnjs.com in my project.
The issue arises when I try to import these assets from src/assets/lib instead of directly from the CDN. For example, importing jQuery like this:
Main.js:
import './assets/lib/jquery.min.js'
This causes my application to stop functioning correctly, with an error stating that jQuery is not defined. However, when I import the assets directly in index.html, everything works fine:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.3.0/raphael.min.js"></script>
Error stack details:
Uncaught ReferenceError: jQuery is not defined
at eval (amalia.js.min.js?c1e6:27)
at Object../src/assets/amalia/build/js/amalia.js.min.js (app.js:1362)
at __webpack_require__ (app.js:849)
... (additional error details follow)
I want to keep these assets within the src/assets folder for future SFC imports in other projects.
I attempted setting window.jQuery but it doesn't seem like the optimal solution, so any assistance from you guys would be greatly appreciated :)