Skip to content

Commit ba7ab87

Browse files
authored
Merge pull request #20303 from mozilla/storybook-jpg-asset-handling
2 parents 6d88ad3 + 21eb11c commit ba7ab87

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

nx.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"build-storybook": {
2424
"dependsOn": ["prebuild", "^build"],
25-
"inputs": ["production", "^production"],
25+
"inputs": ["production", "^production", "{projectRoot}/.storybook/**/*"],
2626
"outputs": ["{projectRoot}/storybook-static"],
2727
"cache": true
2828
},

packages/fxa-settings/.storybook/webpack.config.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,16 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
module.exports = require('fxa-react/configs/storybooks').customizeWebpackConfig;
5+
const { customizeWebpackConfig } = require('fxa-react/configs/storybooks');
6+
7+
module.exports = (options) => {
8+
const config = customizeWebpackConfig(options);
9+
// Inline jpg/jpeg as base64 data URLs so they resolve correctly when used
10+
// in CSS custom properties (relative URLs resolve against the stylesheet,
11+
// not the document, causing 404s in hosted Storybook).
12+
config.module.rules[0].oneOf.unshift({
13+
test: /\.(jpg|jpeg)$/,
14+
type: 'asset/inline',
15+
});
16+
return config;
17+
};

0 commit comments

Comments
 (0)