0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-22 02:18:39 +01:00
wagtail/client/storybook/main.js
Thibaud Colas b7d2618d93
Remove Safari 14 support in Wagtail admin – update browserslist and TypeScript (#11258)
Co-authored-by: Sage Abdullah <sage.abdullah@torchbox.com>
2023-12-12 10:54:41 +00:00

74 lines
1.7 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module.exports = {
stories: [
'../../client/**/*.stories.mdx',
'../../client/**/*.stories.@(js|tsx)',
'../../wagtail/**/*.stories.*',
],
addons: ['@storybook/addon-docs', '@storybook/addon-controls'],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
// Redefine Babel config to allow TypeScript class fields `declare`.
// See https://github.com/storybookjs/storybook/issues/12479.
// The resulting configuration is closer to Wagtails Webpack + TypeScript setup,
// preventing other potential issues with JS transpilation differences.
babel: async (options) => ({
...options,
plugins: [],
presets: [
['@babel/preset-typescript', { allowDeclareFields: true }],
['@babel/preset-react', { runtime: 'automatic' }],
],
}),
webpackFinal: (config) => {
/* eslint-disable no-param-reassign */
const rules = [
{
test: /\.(scss|css)$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
url: false,
},
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: ['tailwindcss', 'autoprefixer', 'cssnano'],
},
},
},
'sass-loader',
],
},
{
test: /\.(md|html)$/,
type: 'asset/source',
},
];
config.module.rules = config.module.rules.concat(rules);
// Allow using path magic variables to reduce boilerplate in stories.
config.node = {
__filename: true,
__dirname: true,
};
return config;
},
docs: {
autodocs: true,
},
};