Skip to content

Commit 5c04e23

Browse files
ro-savagerandycoulman
authored andcommitted
Update comments for webpack loaders
1 parent f7e941f commit 5c04e23

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

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

+10-14
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,14 @@ module.exports = function(publicPath) {
126126
}
127127
],
128128
loaders: [
129-
// Default loader: load all assets that are not handled
130-
// by other loaders with the url loader.
131-
// Note: This list needs to be updated with every change of extensions
132-
// the other loaders match.
133-
// E.g., when adding a loader for a new supported file extension,
134-
// we need to add the supported extension to this loader too.
135-
// Add one new line in `exclude` for each loader.
136-
//
137-
// "file" loader makes sure those assets get served by WebpackDevServer.
138-
// When you `import` an asset, you get its (virtual) filename.
139-
// In production, they would get copied to the `build` folder.
140-
// "url" loader works like "file" loader except that it embeds assets
141-
// smaller than specified limit in bytes as data URLs to avoid requests.
142-
// A missing `test` is equivalent to a match.
129+
// ** ADDING/UPDATING LOADERS **
130+
// The "url" loader handles all assets unless explicitly excluded.
131+
// The `exclude` list *must* be updated with every change to loader extensions.
132+
// When adding a new loader, you must add its `test`
133+
// as a new entry in the `exclude` list for "url" loader.
134+
135+
// "url" loader embeds assets smaller than specified size as data URLs to avoid requests.
136+
// Otherwise, it acts like the "file" loader.
143137
{
144138
exclude: [
145139
/\.html$/,
@@ -206,6 +200,8 @@ module.exports = function(publicPath) {
206200
name: 'static/media/[name].[hash:8].[ext]'
207201
}
208202
}
203+
// ** STOP ** Are you adding a new loader?
204+
// Remember to add the new extension(s) to the "url" loader exclusion list.
209205
]
210206
},
211207
// @remove-on-eject-begin

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$/,
@@ -207,6 +203,8 @@ module.exports = {
207203
name: 'static/media/[name].[hash:8].[ext]'
208204
}
209205
}
206+
// ** STOP ** Are you adding a new loader?
207+
// Remember to add the new extension(s) to the "url" loader exclusion list.
210208
]
211209
},
212210
// @remove-on-eject-begin

0 commit comments

Comments
 (0)