Reputation: 13083
With the default new Angular CLI based project and it's webpack integration some things are weird. Where are the default bundles configured?
I removed the styles.css file now the project doesn't build.
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]chunk {main} main.bundle.js, main.bundle.js.map (main) 303 bytes [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 323 bytes [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 342 bytes [initial] [rendered]
ERROR in multi ./src/styles.css
Module not found: Error: Can't resolve 'D:\project\src\styles.css'
Upvotes: 0
Views: 42
Reputation: 93073
The Angular CLI provides configurations options using .angular-cli.json
. This has a defined schema that defines the options that can be configured. As the Angular CLI wraps up Webpack for you, you can't get direct access to the Webpack config itself when using the Angular CLI. You have a couple of options:
.angular-cli.json
, if they fit.Use ng eject
on your project:
ng eject ejects your app and output the proper webpack configuration and scripts.
Once ejected, you can modify the Webpack configuration accordingly.
In order to fix your specific issue with styles.css
, you can just go with option 1 and update .angular-cli.json
to exclude this file - It's essentially specified under apps[0].styles
, which defaults to an array with a single element: styles.css
.
Upvotes: 1
Reputation: 71911
Inside your .angular-cli.json
file there is still a reference to the styles.css
. Remove the entry from apps.styles
as well, and it won't throw an error anymore
Upvotes: 1