Skip to content

Commit 0ac0d11

Browse files
committed
Update comments for webpack loaders
1 parent 9e0e18f commit 0ac0d11

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

Diff for: packages/react-scripts/config/webpack.config.dev.js

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

Diff for: packages/react-scripts/config/webpack.config.prod.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,14 @@ module.exports = {
120120
}
121121
],
122122
loaders: [
123-
// Default loader: load all assets that are not handled
124-
// by other loaders with the url loader.
125-
// Note: This list needs to be updated with every change of extensions
126-
// the other loaders match.
127-
// E.g., when adding a loader for a new supported file extension,
128-
// we need to add the supported extension to this loader too.
129-
// Add one new line in `exclude` for each loader.
130-
//
131-
// "file" loader makes sure those assets end up in the `build` folder.
132-
// When you `import` an asset, you get its filename.
133-
// "url" loader works just like "file" loader but it also embeds
134-
// assets smaller than specified size as data URLs to avoid requests.
123+
// ** ADDING/UPDATING LOADERS **
124+
// The "url" loader handles all assets unless explicitly excluded.
125+
// The `exclude` list *must* be updated with every change to loader extensions.
126+
// When adding a new loader, you must add its `test`
127+
// as a new entry in the `exclude` list in the "url" loader.
128+
129+
// "url" loader embeds assets smaller than specified size as data URLs to avoid requests.
130+
// Otherwise, it acts like the "file" loader.
135131
{
136132
exclude: [
137133
/\.html$/,
@@ -189,6 +185,8 @@ module.exports = {
189185
name: 'static/media/[name].[hash:8].[ext]'
190186
}
191187
}
188+
// ** STOP ** Are you adding a new loader?
189+
// Remember to add the new extension(s) to the "url" loader exclusion list.
192190
]
193191
},
194192
// @remove-on-eject-begin

0 commit comments

Comments
 (0)