In my angular, I am loading jquery
from extranal and it works. But, after the build
, I am getting an error Uncaught ReferenceError: jQuery is not defined
. My build downloads the jquery
, mind you.
Question: How can I map the jquery
with my build?
index.html:
<script type="systemjs-importmap">
{
"imports": {
"single-spa": "https://cdn.jsdelivr.net/npm/single-spa@5.8.2/lib/system/single-spa.min.js",
"jquery": "https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"
}
}
</script>
<script>
System.import("single-spa");
System.import("jquery");
</script>
webpack config ( it works well locally )
module.exports = {
externals: {
jquery: ["jQuery"],
},
};
Note: After the build, if I run it in server, I get the error:
Uncaught ReferenceError: jQuery is not defined
at Object.xeH2 (main-es2015.3ee70c890346f45d7daa.js:2)
at l (runtime-es2015.cdfb0ddb511f65fdc0a0.js:1)
at Module.zUnb (main-es2015.3ee70c890346f45d7daa.js:2)
at l (runtime-es2015.cdfb0ddb511f65fdc0a0.js:1)
at Object.0 (main-es2015.3ee70c890346f45d7daa.js:2)
at l (runtime-es2015.cdfb0ddb511f65fdc0a0.js:1)
at t (runtime-es2015.cdfb0ddb511f65fdc0a0.js:1)
at Array.r [as push] (runtime-es2015.cdfb0ddb511f65fdc0a0.js:1)
at main-es2015.3ee70c890346f45d7daa.js:2
My server try to download the jquery
from an external source.