Skip to content

Commit 047837d

Browse files
fix: output css source map (#1794)
* fix: output css source map * Add changeset * test: Correct build tests for css maps * test: Wrong dep versions => wrong file hashes * test: Correct asset-manifest size --------- Co-authored-by: Ryan Christian <rchristian@ryanchristian.dev>
1 parent 8d65d94 commit 047837d

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

.changeset/old-eels-occur.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'preact-cli': patch
3+
---
4+
5+
Output CSS source map on build

packages/cli/src/lib/webpack/webpack-client-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ function isProd(env) {
249249
cssProcessorOptions: {
250250
// Fix keyframes in different CSS chunks minifying to colliding names:
251251
reduceIdents: false,
252+
map: { inline: false, annotation: true },
252253
},
253254
}),
254255
],

packages/cli/tests/images/build.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ exports.default = Object.assign({}, common, {
1919
'ssr-build/ssr-bundle.js.map': 52686,
2020
'ssr-build/asset-manifest.json': 178,
2121
'bundle.4c6ac.css': 1276,
22+
'bundle.4c6ac.css.map': 2234,
2223
'bundle.c4895.js': 22529,
2324
'bundle.c4895.js.map': 111801,
2425
'favicon.ico': 15086,
2526
'index.html': 4127,
2627
'manifest.json': 455,
2728
'preact_prerender_data.json': 11,
2829
'push-manifest.json': 388,
29-
'asset-manifest.json': 1142,
30-
'route-home.chunk.9bcab.css': 834,
30+
'asset-manifest.json': 1262,
31+
'route-home.chunk.9bcab.css': 876,
32+
'route-home.chunk.9bcab.css.map': 1349,
3133
'route-home.chunk.5d28d.js': 1149,
3234
'route-home.chunk.5d28d.js.map': 1961,
3335
'route-profile.chunk.4c330.js': 3490,
@@ -44,7 +46,7 @@ exports['default-esm'] = Object.assign({}, exports.default, {
4446
'route-profile.chunk.*.esm.js.map': 14942,
4547
'index.html': 4221,
4648
'push-manifest.json': 404,
47-
'asset-manifest.json': 1174,
49+
'asset-manifest.json': 1294,
4850
});
4951

5052
exports.sass = `
@@ -312,8 +314,10 @@ exports.publicPath = `
312314
<meta name="apple-mobile-web-app-capable" content="yes">
313315
<link rel="apple-touch-icon" href="/example-path/assets/icons/apple-touch-icon.png">
314316
<link rel="manifest" href="/example-path/manifest.json">
315-
<link href="/example-path/bundle.\\w{5}.css" rel="stylesheet">
316-
<style></style>
317+
<link href=\\"/example-path/bundle.\\w{5}.css\\" rel=\\"stylesheet\\" media=\\"only x\\" onload=\\"this.media='all'\\">
318+
<noscript>
319+
<link rel=\\"stylesheet\\" href=\\"\\/example-path/bundle.\\w{5}.css\\">
320+
</noscript>
317321
</head>
318322
<body>
319323
<h1>Public path test</h1>

0 commit comments

Comments
 (0)