#1
Posted
:
Tuesday, December 5, 2017 9:42:51 AM(UTC)
Groups: Registered
Posts: 20
I have an Angular2 application that uses Leadtools. It uses Angular-CLI and webpack to build.
When I attempt to even place the Leadtools.Documents.d.ts in my application folder structure, I get the following error:
Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at createSourceFile (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:16640:109)
at parseSourceFileWorker (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:16572:26)
at Object.parseSourceFile (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:16521:26)
at Object.createSourceFile (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:16371:29)
at WebpackCompilerHost.getSourceFile (D:\Apps\PCV2\node_modules\@ngtools\webpack\src\compiler_host.js:239:27)
at findSourceFile (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70246:29)
at args (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70200:85)
at getSourceFileFromReferenceWorker (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70173:34)
at processSourceFile (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70200:13)
at D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70287:17
at Object.forEach (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:1506:30)
at processReferencedFiles (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70285:16)
at findSourceFile (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70270:21)
at processImportedModules (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70393:25)
at findSourceFile (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70274:17)
at processImportedModules (D:\Apps\PCV2\node_modules\typescript\lib\typescript.js:70393:25)
Removing this file removes the error.
Any help would be appreciated.
#2
Posted
:
Thursday, December 7, 2017 2:48:51 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 199
Was thanked: 28 time(s) in 28 post(s)
Hello Kevin,
Apologies for the long delay before getting a response from us. There is an issue on the angular-cli github that appears to be exactly what you're experiencing:
https://github.com/angular/angular-cli/issues/5053.
Looking through that, it could a number of things, here are two to check for starters:
- Ensure any file referenced in the .d.ts files via ///<reference path="./foo.d.ts" /> exists
- Check if you have a file environment.prod.ts, below is an example from one of the users on the issue linked above
Code:
export const environment = {
production: true,
silent: false
};
Anthony Northrup
Developer Support Engineer
LEAD Technologies, Inc.
#3
Posted
:
Friday, December 8, 2017 9:26:14 AM(UTC)
Groups: Registered
Posts: 20
Thank you. The references in Leadtools.Documents.d.ts was the problem.
I changed:
/// <reference path="jquery/jquery.d.ts" />
To point to the jquery index file in my node-modules:
/// <reference path="../../../../../node_modules/@types/jquery/index.d.ts" />
This solved my issues.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.