Skip to content

Commit 953ce8e

Browse files
ro-savageDaniel Figueiredo
authored andcommitted
Update comments for webpack loaders
1 parent dff04fe commit 953ce8e

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,20 +115,14 @@ module.exports = {
115115
}
116116
],
117117
loaders: [
118-
// Default loader: load all assets that are not handled
119-
// by other loaders with the url loader.
120-
// Note: This list needs to be updated with every change of extensions
121-
// the other loaders match.
122-
// E.g., when adding a loader for a new supported file extension,
123-
// we need to add the supported extension to this loader too.
124-
// Add one new line in `exclude` for each loader.
125-
//
126-
// "file" loader makes sure those assets get served by WebpackDevServer.
127-
// When you `import` an asset, you get its (virtual) filename.
128-
// In production, they would get copied to the `build` folder.
129-
// "url" loader works like "file" loader except that it embeds assets
130-
// smaller than specified limit in bytes as data URLs to avoid requests.
131-
// A missing `test` is equivalent to a match.
118+
// ** ADDING/UPDATING LOADERS **
119+
// The "url" loader handles all assets unless explicitly excluded.
120+
// The `exclude` list *must* be updated with every change to loader extensions.
121+
// When adding a new loader, you must add its `test`
122+
// as a new entry in the `exclude` list for "url" loader.
123+
124+
// "url" loader embeds assets smaller than specified size as data URLs to avoid requests.
125+
// Otherwise, it acts like the "file" loader.
132126
{
133127
exclude: [
134128
/\.html$/,
@@ -182,6 +176,8 @@ module.exports = {
182176
name: 'static/media/[name].[hash:8].[ext]'
183177
}
184178
}
179+
// ** STOP ** Are you adding a new loader?
180+
// Remember to add the new extension(s) to the "url" loader exclusion list.
185181
]
186182
},
187183
// @remove-on-eject-begin

packages/react-scripts/config/webpack.config.prod.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,14 @@ module.exports = {
123123
}
124124
],
125125
loaders: [
126-
// Default loader: load all assets that are not handled
127-
// by other loaders with the url loader.
128-
// Note: This list needs to be updated with every change of extensions
129-
// the other loaders match.
130-
// E.g., when adding a loader for a new supported file extension,
131-
// we need to add the supported extension to this loader too.
132-
// Add one new line in `exclude` for each loader.
133-
//
134-
// "file" loader makes sure those assets end up in the `build` folder.
135-
// When you `import` an asset, you get its filename.
136-
// "url" loader works just like "file" loader but it also embeds
137-
// assets smaller than specified size as data URLs to avoid requests.
126+
// ** ADDING/UPDATING LOADERS **
127+
// The "url" loader handles all assets unless explicitly excluded.
128+
// The `exclude` list *must* be updated with every change to loader extensions.
129+
// When adding a new loader, you must add its `test`
130+
// as a new entry in the `exclude` list in the "url" loader.
131+
132+
// "url" loader embeds assets smaller than specified size as data URLs to avoid requests.
133+
// Otherwise, it acts like the "file" loader.
138134
{
139135
exclude: [
140136
/\.html$/,
@@ -192,6 +188,8 @@ module.exports = {
192188
name: 'static/media/[name].[hash:8].[ext]'
193189
}
194190
}
191+
// ** STOP ** Are you adding a new loader?
192+
// Remember to add the new extension(s) to the "url" loader exclusion list.
195193
]
196194
},
197195
// @remove-on-eject-begin

0 commit comments

Comments
 (0)