Instructor: I've added some basic reset rules in this styles.css file. I'd like to include that in the app by default. I'm going to come into the index.js file, I'm going to add an import for this CSS, and see what happens.
I'm just going to import relative path to styles.css. Then in the terminal, I'm going to npm run dev. Let's make sure we save the file before we run that, npm run dev. It's going to struggle to start our app. If I switch back to the terminal, and we scroll up, we're going to find an error in sourceStyles.css, line one.
We need to do something similar for CSS. I'm going to hit Control+C in the terminal to clear that out. We'll start with an npm i -d, because we want to save these as dev dependencies. We're going to install two loaders, the CSS loader and the style loader.
With those installed, we can come up into our webpack config base, and we can add another rule. We're going to add another object to our rules array. It's going to have a test. We'll give it a regular expression that tells it to test for CSS extensions.
This is deprecated, and the option we're supposed to use now is use. Use is going to take an array of loaders. We're going to pass it style loader and CSS loader. That needs to be a string. Then we're going to exclude Node modules.
CSS loader is going to let webpack handle the CSS syntax, and then style loader is actually going to take that inject CSS and inject a style tag into our HTML at runtime. Let's save this file, and then we're going to do an npm run dev, and we'll see if it works.
We'll see that our application loads up, and our styles that slightly different than they were before. Let's make it really obvious. I'm going to come into styles.css, and I'm just going to make our background color something really obvious.