@nitro/webpack 11.0.5 → 11.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitro/webpack",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.6",
|
|
4
4
|
"description": "nitro webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "The Nitro Team",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"nitro"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@nitro/app": ">=11.0.
|
|
25
|
+
"@nitro/app": ">=11.0.6",
|
|
26
26
|
"webpack": "^5"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
@@ -212,7 +212,7 @@ module.exports = (options = { rules: {}, features: {} }) => {
|
|
|
212
212
|
// images
|
|
213
213
|
if (options.rules.image) {
|
|
214
214
|
const imageRule = {
|
|
215
|
-
test: /\.(png|
|
|
215
|
+
test: /\.(png|jpe?g|gif|svg|webp)$/i,
|
|
216
216
|
type: 'asset',
|
|
217
217
|
parser: {
|
|
218
218
|
dataUrlCondition: {
|
|
@@ -220,7 +220,11 @@ module.exports = (options = { rules: {}, features: {} }) => {
|
|
|
220
220
|
},
|
|
221
221
|
},
|
|
222
222
|
generator: {
|
|
223
|
-
filename:
|
|
223
|
+
filename: (pathData) => {
|
|
224
|
+
const match = pathData.filename.match(/\.([^.?#]+)(?:[?#].*)?$/);
|
|
225
|
+
const extNoDot = match ? match[1] : 'asset';
|
|
226
|
+
return `media/${extNoDot}/[name]-[contenthash:7][ext]`;
|
|
227
|
+
},
|
|
224
228
|
},
|
|
225
229
|
};
|
|
226
230
|
webpackConfig.module.rules.push(utils.getEnrichedConfig(imageRule, options.rules.image));
|
|
@@ -277,7 +277,7 @@ module.exports = (options = { rules: {}, features: {} }) => {
|
|
|
277
277
|
// images
|
|
278
278
|
if (options.rules.image) {
|
|
279
279
|
const imageRule = {
|
|
280
|
-
test: /\.(png|
|
|
280
|
+
test: /\.(png|jpe?g|gif|svg|webp)$/i,
|
|
281
281
|
type: 'asset',
|
|
282
282
|
parser: {
|
|
283
283
|
dataUrlCondition: {
|
|
@@ -285,7 +285,11 @@ module.exports = (options = { rules: {}, features: {} }) => {
|
|
|
285
285
|
},
|
|
286
286
|
},
|
|
287
287
|
generator: {
|
|
288
|
-
filename:
|
|
288
|
+
filename: (pathData) => {
|
|
289
|
+
const match = pathData.filename.match(/\.([^.?#]+)(?:[?#].*)?$/);
|
|
290
|
+
const extNoDot = match ? match[1] : 'asset';
|
|
291
|
+
return `media/${extNoDot}/[name]-[contenthash:7][ext]`;
|
|
292
|
+
},
|
|
289
293
|
},
|
|
290
294
|
};
|
|
291
295
|
|