Adding libraries to aurelia SPA template errors #298

Closed
opened 2025-08-09 17:15:45 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @robscottnh on 12/3/2017

I'm having great difficulty adding several libraries to an app built using the Aurelia SPA template. Something as simple as adding the numeral library fails with:

ERROR in ./ClientApp/app/components/counter/counter.ts
(1,9): error TS2305: Module '"numeral"' has no exported member 'numeral'.

this is after doing the following:

  1. running npm install for the typings and the library which results in the following in the package.json file:

'''
"dependencies": {
"@types/numeral": "0.0.22",
"numeral": "^2.0.6"
}
'''

  1. updating the boot.ts file with the following:
    '''
    aurelia.use.standardConfiguration()
    .plugin(PLATFORM.moduleName("numeral"));
    '''

  2. adding the following to counter.ts
    '''
    import {numeral} from "numeral"

export class Counter {
public currentCount = 0;

public incrementCounter() {
    this.currentCount++;
}

}
'''
Some libraries such as aurelia-validation or aurelia-bootstrap-datetimepicker work fine using the same process, while others such as aurelia-api or aurelia-value-converters fail with similar errors or the infamous ModuleID "..." not found error.

As I'm just learning the intricacies of webpack and aurelia, it's highly likely that these are errors on my part..., but after much searching and numerous email exchanges with other aurelia developers, who say "I did the same thing you did, but using one of the Aurelia skeletons (not these skeletons) and it just worked...", I'm stumped.

Regards,
Rob

*Originally created by @robscottnh on 12/3/2017* I'm having great difficulty adding several libraries to an app built using the Aurelia SPA template. Something as simple as adding the numeral library fails with: ERROR in ./ClientApp/app/components/counter/counter.ts (1,9): error TS2305: Module '"numeral"' has no exported member 'numeral'. this is after doing the following: 1) running npm install for the typings and the library which results in the following in the package.json file: ''' "dependencies": { "@types/numeral": "0.0.22", "numeral": "^2.0.6" } ''' 2) updating the boot.ts file with the following: ''' aurelia.use.standardConfiguration() .plugin(PLATFORM.moduleName("numeral")); ''' 3) adding the following to counter.ts ''' import {numeral} from "numeral" export class Counter { public currentCount = 0; public incrementCounter() { this.currentCount++; } } ''' Some libraries such as aurelia-validation or aurelia-bootstrap-datetimepicker work fine using the same process, while others such as aurelia-api or aurelia-value-converters fail with similar errors or the infamous ModuleID "..." not found error. As I'm just learning the intricacies of webpack and aurelia, it's highly likely that these are errors on my part..., but after much searching and numerous email exchanges with other aurelia developers, who say "I did the same thing you did, but using one of the Aurelia skeletons (not these skeletons) and it just worked...", I'm stumped. Regards, Rob
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#298
No description provided.