Angular2SPA, Importing CSS from node_modules with @ on the name #1364

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

Originally created by @nklt on 9/23/2016

In the Angular2SPA template, the Angular 2 style statement cannot use @ character on the style path, if it is referencing a css file located inside a node_module with @ character on its name.

Example will be Telerik Kendo UI. One their website, their public npm is @progress.
http://www.telerik.com/kendo-angular-ui/getting-started

@Component({
selector: 'counter',
styles: [require('@progress/kendo-angular-buttons/dist/npm/css/main.css')], // load the button theme
template: require('./counter.component.html')
})

when the path is added the TSC generates the following error.

ERROR in ./ClientApp/app/components/app/app.component.css
Module parse failed: C:\workspace9\Angular2Spa\ClientApp\app\components\app\app.component.css Unexpected character '@' (1:0)

When the @ is removed, the TSC only complains the path cannot be found.

*Originally created by @nklt on 9/23/2016* In the Angular2SPA template, the Angular 2 style statement cannot use @ character on the style path, if it is referencing a css file located inside a node_module with @ character on its name. Example will be Telerik Kendo UI. One their website, their public npm is @progress. http://www.telerik.com/kendo-angular-ui/getting-started @Component({ selector: 'counter', styles: [require('@progress/kendo-angular-buttons/dist/npm/css/main.css')], // load the button theme template: require('./counter.component.html') }) when the path is added the TSC generates the following error. ERROR in ./ClientApp/app/components/app/app.component.css Module parse failed: C:\workspace9\Angular2Spa\ClientApp\app\components\app\app.component.css Unexpected character '@' (1:0) When the @ is removed, the TSC only complains the path cannot be found.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1364
No description provided.