How to resolve jQuery is not defined issue in latest angular builder(application, browser-esbuild)
The issue will occur only when we use the latest angular builder(application, browser-esbuild).The issue can be resolved by following the below steps.
-
Refer the jQuery script file (
jquery.js) as given in theangular.jsonfile within theprojectname > scriptssection (For example,reportviewerapp > scripts).{ "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "project": { "name": "reportviewerapp" }, "reportviewerapp": [ { "root": "src", "outDir": "dist", . . . . . . "styles": [], "scripts": ["./node_modules/jquery/dist/jquery.js"], . . . . . . } -
Remove the
src/globals.tsfile entirely. Eliminate all references tosrc/globals.tsfile in both thets.configapp.jsonandsrc/app/app.module.tsfiles.