Skip to content

Commit f0dca9a

Browse files
authored
docs: modernize loader example using css-loader (#8088)
1 parent aed52e4 commit f0dca9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/content/concepts/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ export default {
112112
filename: "my-first-webpack.bundle.js",
113113
},
114114
module: {
115-
rules: [{ test: /\.txt$/, use: "raw-loader" }],
115+
rules: [{ test: /\.js$/, use: "babel-loader" }],
116116
},
117117
};
118118
```
119119
120120
The configuration above has defined a `rules` property for a single module with two required properties: `test` and `use`. This tells webpack's compiler the following:
121121
122-
> "Hey webpack compiler, when you come across a path that resolves to a '.txt' file inside of a `require()`/`import` statement, **use** the `raw-loader` to transform it before you add it to the bundle."
122+
> "Hey webpack compiler, when you come across a path that resolves to a '.js' file inside of a `require()`/`import` statement, **use** the `babel-loader` to transform it before you add it to the bundle."
123123
124124
W> It is important to remember that when defining rules in your webpack config, you are defining them under `module.rules` and not `rules`. For your benefit, webpack will warn you if this is done incorrectly.
125125
@@ -143,7 +143,7 @@ import webpack from "webpack"; // to access built-in plugins
143143

144144
export default {
145145
module: {
146-
rules: [{ test: /\.txt$/, use: "raw-loader" }],
146+
rules: [{ test: /\.js$/, use: "babel-loader" }],
147147
},
148148
plugins: [new HtmlWebpackPlugin({ template: "./src/index.html" })],
149149
};

0 commit comments

Comments
 (0)