Fix Storybook not supporting TypeScript declare class fields

pull/10080/head
Thibaud Colas 2023-02-14 11:18:29 +00:00 zatwierdzone przez LB (Ben Johnston)
rodzic fa1cbfbe98
commit 0246d3a6f4
1 zmienionych plików z 12 dodań i 0 usunięć

Wyświetl plik

@ -14,6 +14,18 @@ module.exports = {
core: {
builder: 'webpack5',
},
// 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 */