Skip to content

Commit

Permalink
fix: output css source map (#1794)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
teodragovic and rschristian authored Jun 30, 2023
1 parent 8d65d94 commit 047837d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-eels-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'preact-cli': patch
---

Output CSS source map on build
1 change: 1 addition & 0 deletions packages/cli/src/lib/webpack/webpack-client-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ function isProd(env) {
cssProcessorOptions: {
// Fix keyframes in different CSS chunks minifying to colliding names:
reduceIdents: false,
map: { inline: false, annotation: true },
},
}),
],
Expand Down
14 changes: 9 additions & 5 deletions packages/cli/tests/images/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ exports.default = Object.assign({}, common, {
'ssr-build/ssr-bundle.js.map': 52686,
'ssr-build/asset-manifest.json': 178,
'bundle.4c6ac.css': 1276,
'bundle.4c6ac.css.map': 2234,
'bundle.c4895.js': 22529,
'bundle.c4895.js.map': 111801,
'favicon.ico': 15086,
'index.html': 4127,
'manifest.json': 455,
'preact_prerender_data.json': 11,
'push-manifest.json': 388,
'asset-manifest.json': 1142,
'route-home.chunk.9bcab.css': 834,
'asset-manifest.json': 1262,
'route-home.chunk.9bcab.css': 876,
'route-home.chunk.9bcab.css.map': 1349,
'route-home.chunk.5d28d.js': 1149,
'route-home.chunk.5d28d.js.map': 1961,
'route-profile.chunk.4c330.js': 3490,
Expand All @@ -44,7 +46,7 @@ exports['default-esm'] = Object.assign({}, exports.default, {
'route-profile.chunk.*.esm.js.map': 14942,
'index.html': 4221,
'push-manifest.json': 404,
'asset-manifest.json': 1174,
'asset-manifest.json': 1294,
});

exports.sass = `
Expand Down Expand Up @@ -312,8 +314,10 @@ exports.publicPath = `
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-icon" href="/example-path/assets/icons/apple-touch-icon.png">
<link rel="manifest" href="/example-path/manifest.json">
<link href="/example-path/bundle.\\w{5}.css" rel="stylesheet">
<style></style>
<link href=\\"/example-path/bundle.\\w{5}.css\\" rel=\\"stylesheet\\" media=\\"only x\\" onload=\\"this.media='all'\\">
<noscript>
<link rel=\\"stylesheet\\" href=\\"\\/example-path/bundle.\\w{5}.css\\">
</noscript>
</head>
<body>
<h1>Public path test</h1>
Expand Down

0 comments on commit 047837d

Please sign in to comment.