-
Notifications
You must be signed in to change notification settings - Fork 12k
3rd party library fails - #2141 has returned... #5969
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
Hard. Have you tried the following? |
I’m pretty sure that I have. But I’ll try that specific scenario again here in about 30-45 minutes.
From: cenkentimist [mailto:[email protected]]
Sent: Wednesday, April 19, 2017 9:28 AM
To: angular/angular-cli <[email protected]>
Cc: Phil Boyd <[email protected]>; Author <[email protected]>
Subject: Re: [angular/angular-cli] 3rd party library fails - #2141 has returned... (#5969)
Hard. Have you tried the following?
npm install --save jquery
npm install --save @types/jquery
import "jquery"
To get bootstrap working I had to add "../node_modules/jquery" to the scripts array in .angular-cli.json this should not be necessary in your case.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#5969 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AD_ZHNszm-Hhp0QUVyJSJlsaOForahBmks5rxgvPgaJpZM4M-O2u>.
|
Here’s what I’ve accomplished so far:
1. Brand new CLI project from scratch
2. npm i jquery and @types/jquery
3. import ‘jquery’ in component
4. add “$.delay(5000);” to component – causes build error
5. Added JQueryStatic interface with delay method to src/typings.d.ts
6. App builds, but get ReferenceError: $ is not defined at run-time
7. Add “declare var $: any” after import statements to component
8. Still get same error as 6
|
Changing “import ‘jquery’;” to “import * as $ from 'jquery';” gives a different run-time error:
ERROR TypeError: __WEBPACK_IMPORTED_MODULE_1_jquery__.delay is not a function
Which I think is caused by how the default webpack.config used by angular-cli is loading the jquery.
|
short version: installing @types/jquery should be sufficient to get the type. |
Thank you so much for putting up with my bone-headedness. Those 7 words were the only answer that I have so far to help me: |
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. |
Output from:
ng --version
. cli version 1.0.0, node: 7.8.0 win32 x64created new angular-cli app.
Tried every combination of fix suggested, but the end result is:
WEBPACK_IMPORTED_MODULE_1_jquery.delay is not a function.
How hard can it be to import a library?
The text was updated successfully, but these errors were encountered: