Troubleshooting "styles.bundle.js:33Uncaught Error" Error When Using Angular-CLI with SCSS
You have encountered an issue where Angular-CLI throws the error "styles.bundle.js:33Uncaught Error" when using SCSS. While the documentation states that running ng set defaults.styleExt scss should resolve this, it's not working for you. Let's explore the reasons behind this and provide a comprehensive solution.
Cause of the Error
The error occurs because the CLI is still attempting to find and bundle CSS files for styling. Angular-CLI initially starts with CSS as the default style extension. When you attempt to use SCSS, the CLI must be configured to recognize and process SCSS files.
Solution for Existing Projects
Update Default Style Extension:
Rename CSS Files to SCSS:
Update Angular.json (Only for Angular 6 ):
Point Components to New Style Files:
Solution for Future Projects
Set Style Extension During Project Creation:
Set Global Default:
ng config --global defaults.styleExt=scss
The above is the detailed content of How to Fix the 'styles.bundle.js:33 Uncaught Error' in Angular-CLI When Using SCSS?. For more information, please follow other related articles on the PHP Chinese website!