-
Notifications
You must be signed in to change notification settings - Fork 12k
jQuery not found in prod build #1413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi I had the same issue with jquery in -prod and I was able to solve it by following the directions from here: #1118 |
@unseen1980: Not sure what instructions you mean. If you'll look at my reference project, everything is configured properly. Have you ran your config as -prod? When you build for production, all thrid party libraries not in the polyfills array are merged into main.js and loaded at the end of index.html. In my builds, jQuery is loaded after my application JS files so they cannot reference jQuery. Other third party libraries are OK with jQuery in my configuration. So when I load bootstrap using the 3rd party configuration, bootstrap is OK. My problem is using jQuery in my app JS with this configuration. It looks like one of two approaches will solve this:
I would personally prefer to be able to include jQuery with the polyfills. In the meantime, I am loading it manually above the polyfills from the CDN and including the typings definition in my project with the other polyfills definitions. |
Ok, for me it was not loading the jquery at all. |
Looks like I pushed the wrong thing to my repo. That is fixed. $ is used otherwise by one of the polyfills. (very irritating). I tried Once the page is entirely loaded, the jQuery object does get loaded into the global space. However, the problem is the order of loading. jQuery is not available for any of my app JS. |
Closed as this issue was made obsolete by #1455. |
Just to clarify, upgrading to 11 should fix this? Thanks, @filipesilva |
@rkralston correct. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
ng --version
. If there's nothing outputted, pleaserun in a Terminal:
node --version
And paste the result here.
angular-cli: 1.0.0-beta.10
node: 6.1.0
os: win32 x64
do on your code? etc.
Loading jQuery as a 3rd partly library, references in components fail.
npm i jquery --save
typings install dt~jquery --global --save
angular-cli-build.js:
'jquery/dist/jquery.min.+(js|map)',
system-config.js:
const map: any = { 'jquery': 'vendor/jquery/dist/' };
const packages: any = { 'jquery': { defaultExtension: 'js', main: 'jquery.min.js', format: 'cjs' } };
app.component.ts:
import * as jquery from 'jquery'; . . . console.log(jquery); . . . jQuery('#input');
The log given by the failure. Normally this include a stack trace and some
more information.
Mention any other details that might be useful.
https://github.com/rkralston/test-app
The text was updated successfully, but these errors were encountered: