Skip to content

Commit 26cbb75

Browse files
fix(docs-framework): update webpack to handle all images the same way (#4843)
1 parent a49a78b commit 26cbb75

File tree

4 files changed

+12
-73
lines changed

4 files changed

+12
-73
lines changed

packages/documentation-framework/components/example/example.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ export const Example = ({
108108
// absolute url to hosted file
109109
sourceLink = ''
110110
}) => {
111+
112+
111113
if (isFullscreenPreview) {
112114
isFullscreen = false;
113115
}
@@ -264,6 +266,11 @@ export const Example = ({
264266
);
265267
const metaText = hasMetaText && tooltips;
266268

269+
const thumbnailDimensions = {
270+
width: "800",
271+
height: "450"
272+
}
273+
267274
return (
268275
<Stack hasGutter>
269276
<StackItem>
@@ -281,7 +288,7 @@ export const Example = ({
281288
target="_blank"
282289
aria-label={`Open fullscreen ${title} example`}
283290
>
284-
<img src={thumbnail.src} width={thumbnail.width} height={thumbnail.height} alt={`${title} screenshot`} />
291+
<img src={thumbnail} width={thumbnailDimensions.width} height={thumbnailDimensions.height} alt={`${title} screenshot`} />
285292
</a>
286293
</div>
287294
) : (

packages/documentation-framework/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
"remark-mdxjs": "2.0.0-next.8",
5555
"remark-parse": "8.0.3",
5656
"remark-squeeze-paragraphs": "4.0.0",
57-
"responsive-loader": "3.1.2",
5857
"sharp": "0.33.0",
5958
"style-to-object": "0.3.0",
6059
"to-vfile": "6.1.0",

packages/documentation-framework/scripts/webpack/webpack.base.config.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,7 @@ module.exports = (_env, argv) => {
7272
}
7373
},
7474
{
75-
test: /\.(png|jpe?g|webp)$/,
76-
use: {
77-
loader: 'responsive-loader',
78-
options: {
79-
adapter: require('responsive-loader/sharp'),
80-
name: '[name].[contenthash].[ext]',
81-
outputPath: 'images/'
82-
}
83-
}
84-
},
85-
{
86-
test: /\.(gif|svg)$/,
75+
test: /\.(gif|svg|png|jpe?g|webp)$/,
8776
type: 'asset/resource',
8877
dependency: { not: ['url'] },
8978
generator: {

yarn.lock

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4151,7 +4151,6 @@ __metadata:
41514151
remark-mdxjs: "npm:2.0.0-next.8"
41524152
remark-parse: "npm:8.0.3"
41534153
remark-squeeze-paragraphs: "npm:4.0.0"
4154-
responsive-loader: "npm:3.1.2"
41554154
sharp: "npm:0.33.0"
41564155
style-to-object: "npm:0.3.0"
41574156
to-vfile: "npm:6.1.0"
@@ -5959,15 +5958,6 @@ __metadata:
59595958
languageName: node
59605959
linkType: hard
59615960

5962-
"@types/node@npm:^18.11.9":
5963-
version: 18.19.32
5964-
resolution: "@types/node@npm:18.19.32"
5965-
dependencies:
5966-
undici-types: "npm:~5.26.4"
5967-
checksum: 10c0/29d60ddd83a8216daf90d4bf101a6eff7fcf034b24bb89da90291017ec54c33b5ce30e7c125aef3f23f756037f0c382d15ebd434ad9c4536c8db8f1fb129f0ce
5968-
languageName: node
5969-
linkType: hard
5970-
59715961
"@types/normalize-package-data@npm:^2.4.0":
59725962
version: 2.4.4
59735963
resolution: "@types/normalize-package-data@npm:2.4.4"
@@ -8721,13 +8711,6 @@ __metadata:
87218711
languageName: node
87228712
linkType: hard
87238713

8724-
"commondir@npm:^1.0.1":
8725-
version: 1.0.1
8726-
resolution: "commondir@npm:1.0.1"
8727-
checksum: 10c0/33a124960e471c25ee19280c9ce31ccc19574b566dc514fe4f4ca4c34fa8b0b57cf437671f5de380e11353ea9426213fca17687dd2ef03134fea2dbc53809fd6
8728-
languageName: node
8729-
linkType: hard
8730-
87318714
"compare-func@npm:^2.0.0":
87328715
version: 2.0.0
87338716
resolution: "compare-func@npm:2.0.0"
@@ -11413,17 +11396,6 @@ __metadata:
1141311396
languageName: node
1141411397
linkType: hard
1141511398

11416-
"find-cache-dir@npm:^3.3.2":
11417-
version: 3.3.2
11418-
resolution: "find-cache-dir@npm:3.3.2"
11419-
dependencies:
11420-
commondir: "npm:^1.0.1"
11421-
make-dir: "npm:^3.0.2"
11422-
pkg-dir: "npm:^4.1.0"
11423-
checksum: 10c0/92747cda42bff47a0266b06014610981cfbb71f55d60f2c8216bc3108c83d9745507fb0b14ecf6ab71112bed29cd6fb1a137ee7436179ea36e11287e3159e587
11424-
languageName: node
11425-
linkType: hard
11426-
1142711399
"find-cache-dir@npm:^4.0.0":
1142811400
version: 4.0.0
1142911401
resolution: "find-cache-dir@npm:4.0.0"
@@ -14224,7 +14196,7 @@ __metadata:
1422414196
languageName: node
1422514197
linkType: hard
1422614198

14227-
"json5@npm:^2.1.2, json5@npm:^2.2.1, json5@npm:^2.2.2, json5@npm:^2.2.3":
14199+
"json5@npm:^2.1.2, json5@npm:^2.2.2, json5@npm:^2.2.3":
1422814200
version: 2.2.3
1422914201
resolution: "json5@npm:2.2.3"
1423014202
bin:
@@ -14714,13 +14686,6 @@ __metadata:
1471414686
languageName: node
1471514687
linkType: hard
1471614688

14717-
"loader-utils@npm:^3.2.1":
14718-
version: 3.2.1
14719-
resolution: "loader-utils@npm:3.2.1"
14720-
checksum: 10c0/d3e1f217d160e8e894a0385a33500d4ce14065e8ffb250f5a81ae65bc2c3baa50625ec34182ba4417b46b4ac6725aed64429e1104d6401e074af2aa1dd018394
14721-
languageName: node
14722-
linkType: hard
14723-
1472414689
"locate-path@npm:^2.0.0":
1472514690
version: 2.0.0
1472614691
resolution: "locate-path@npm:2.0.0"
@@ -14931,7 +14896,7 @@ __metadata:
1493114896
languageName: node
1493214897
linkType: hard
1493314898

14934-
"make-dir@npm:3.1.0, make-dir@npm:^3.0.2, make-dir@npm:^3.1.0":
14899+
"make-dir@npm:3.1.0":
1493514900
version: 3.1.0
1493614901
resolution: "make-dir@npm:3.1.0"
1493714902
dependencies:
@@ -18208,7 +18173,7 @@ __metadata:
1820818173
languageName: node
1820918174
linkType: hard
1821018175

18211-
"pkg-dir@npm:^4.1.0, pkg-dir@npm:^4.2.0":
18176+
"pkg-dir@npm:^4.2.0":
1821218177
version: 4.2.0
1821318178
resolution: "pkg-dir@npm:4.2.0"
1821418179
dependencies:
@@ -19966,27 +19931,6 @@ __metadata:
1996619931
languageName: node
1996719932
linkType: hard
1996819933

19969-
"responsive-loader@npm:3.1.2":
19970-
version: 3.1.2
19971-
resolution: "responsive-loader@npm:3.1.2"
19972-
dependencies:
19973-
"@types/node": "npm:^18.11.9"
19974-
find-cache-dir: "npm:^3.3.2"
19975-
json5: "npm:^2.2.1"
19976-
loader-utils: "npm:^3.2.1"
19977-
make-dir: "npm:^3.1.0"
19978-
schema-utils: "npm:^4.0.0"
19979-
peerDependencies:
19980-
webpack: ^5.73.0
19981-
peerDependenciesMeta:
19982-
jimp:
19983-
optional: true
19984-
sharp:
19985-
optional: true
19986-
checksum: 10c0/c93b200bb51fe2968ee8092b4817db55dd55f2306d1d75fa66aa6cd2dbddf9c7f394528f9182acbc3a37489fed9b5d743b51a5275c88d31fb665195cf0f5adaf
19987-
languageName: node
19988-
linkType: hard
19989-
1999019934
"restore-cursor@npm:^2.0.0":
1999119935
version: 2.0.0
1999219936
resolution: "restore-cursor@npm:2.0.0"

0 commit comments

Comments
 (0)