AOT & Angular-CLI throw errors using the base example, new one here
See original GitHub issueWe had a ton of issues related to missing parameters, bad constructors, etc.
First was the @injectable
which I detailed on #76.
The AOT example shows how to use rollUp but Angular pushes people to use the CLI.
To use the CLI, you must include the scripts for cloudinary as a global. Inside .angular-cli.json
scripts:["../node_modules/cloudinary-core/cloudinary-core-shrinkwrap.js"]
This will insure that cloudinary is loaded into the global namespace. We used the shrinkwrap version because the lib needs lodash and the shrinkwrap version has the specific lodash bundled together.
Then in your app.module
// cloudinary.. order may be important with AOT
import { Cloudinary } from 'cloudinary-core/cloudinary-core-shrinkwrap';
import { CloudinaryModule, CloudinaryConfiguration } from '@cloudinary-angular';
const cloudConfig = {
cloud_name: 'your-cloud'
};
const cloudinaryLib = {
Cloudinary: Cloudinary
};
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
CloudinaryModule.forRoot(cloudinaryLib, cloudConfig)
///rest of your code
This cleared all the errors and got everything to compile… Hope it helps!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:13 (2 by maintainers)
Top Results From Across the Web
Ahead-of-time (AOT) compilation
AOT compiles HTML templates and components into JavaScript files long before they are served to the client. With no templates to read and...
Read more >Angular: Writing AoT-friendly applications | by David
The article talks through this topic by an example app. ... For an overview, here are the Angular CLI commands for both development...
Read more >cannot determine the module for component angular 5
Check Case Sensitivity import { MyComponent } from "./User/my-component";. In my case, the problem was that the folder user was created with ......
Read more >Improved Error Logging by the Angular AOT Compiler
For the years, one of the biggest pain in Angular was to debug, because of the error message, there was no clear stack...
Read more >Using the Ahead-of-Time (AOT) Compiler
The Angular AOT compiler extracts the metadata to interpret the Angular application in equivalent JavaScript code. It recognizes the code based ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone still looking for the solutions, it is here (Angular 5 CLI) https://github.com/cloudinary/cloudinary_angular/tree/master/samples/angular-cli-sample
Hello ! I had the same issue with
@angular/cli: 1.0.0-rc.2 node: 7.7.2 os: linux x64 @angular/common: 2.4.9 @angular/compiler: 2.4.9 @angular/core: 2.4.9 @angular/forms: 2.4.9 @angular/http: 2.4.9 @angular/platform-browser: 2.4.9 @angular/platform-browser-dynamic: 2.4.9 @angular/router: 3.4.9 @angular/cli: 1.0.0-rc.2 @angular/compiler-cli: 2.4.9 @cloudinary/angular: ^2.1.1 cloudinary-core: ^2.2.0
I try all posibilities in my module : Today the best solution is the last with
ng serve
worksng serve -aot
doesn’t work.EXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'CloudinaryJQuery' of null
ng build -prod
doesn’t workEXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'CloudinaryJQuery' of null
ng build -aot
doesn’t workEXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'CloudinaryJQuery' of null
UPDATE 1
UPDATE 2
UPDATE 3
import Cloudinary from shrinkwrap doesn’t works too :
import { Cloudinary } from 'cloudinary-core/cloudinary-core-shrinkwrap';
ERROR in ~/src/app/admin/user/user.module.ts (14,28): Cannot find module 'cloudinary-core/cloudinary-core-shrinkwrap'.)
UPDATE 4
TypeError: cloudinaryJsLib.Cloudinary is not a constructor
UPDATE 5
In .angular-cli :
I try to add in my packages.json typings like that with eitanp461’s typings (https://github.com/cloudinary/cloudinary_js/pull/122/commits/714d27d15b7880d21f094bdc1f674d025e7389a7), but it doesn’t work too :