Angular Template: components css #1372

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

Originally created by @rbasniak on 9/20/2016

On Angular template (fresh clone, no edits, just installed packages and ran webpack.vendor.js) I tried to create a style file for the counter component like this:

styles: [require('./counter.component.css')]

Then I got the following exception:

ERROR in ./ClientApp/app/components/counter/counter.component.css
Module build failed: Error: Cannot find module './../../../../node_modules/css-loader/lib/css-base.js'

Based on #132 I changed the css loader on webpack.config.js like this:

{ test: /\.css$/, loader: 'raw-loader' }

Now the page loads, but I get the following error message on Chrome console:

Uncaught Error: Expected 'styles' to be an array of strings.

What is the correct way of setting component stylesheets?

*Originally created by @rbasniak on 9/20/2016* On Angular template (fresh clone, no edits, just installed packages and ran webpack.vendor.js) I tried to create a style file for the counter component like this: `styles: [require('./counter.component.css')]` Then I got the following exception: ``` ERROR in ./ClientApp/app/components/counter/counter.component.css Module build failed: Error: Cannot find module './../../../../node_modules/css-loader/lib/css-base.js' ``` Based on #132 I changed the css loader on webpack.config.js like this: `{ test: /\.css$/, loader: 'raw-loader' }` Now the page loads, but I get the following error message on Chrome console: `Uncaught Error: Expected 'styles' to be an array of strings.` What is the correct way of setting component stylesheets?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1372
No description provided.