-
Notifications
You must be signed in to change notification settings - Fork 6.3k
/
Copy pathmain.ts
75 lines (71 loc) · 2.12 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { join } from 'node:path';
import type { StorybookConfig } from '@storybook/react-webpack5';
const mocksFolder = join(__dirname, '../components/__mocks__');
const config: StorybookConfig = {
stories: ['../components/**/*.stories.tsx'],
logLevel: 'error',
staticDirs: ['../public'],
typescript: { reactDocgen: false, check: false },
core: { disableTelemetry: true, disableWhatsNewNotifications: true },
framework: '@storybook/react-webpack5',
swc: () => ({
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
transform: {
react: {
runtime: 'automatic',
},
},
},
}),
addons: [
'@storybook/addon-webpack5-compiler-swc',
'@storybook/addon-controls',
'@storybook/addon-interactions',
'@storybook/addon-themes',
'@storybook/addon-viewport',
{
name: '@storybook/addon-styling-webpack',
options: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
{ loader: 'css-loader', options: { url: false } },
'postcss-loader',
],
},
],
},
},
],
webpack: async config => ({
...config,
// We want to conform as much as possible with our target settings
target: 'browserslist:development',
// Performance Hints do not make sense on Storybook as it is bloated by design
performance: { hints: false },
// `nodevu` is a Node.js-specific package that requires Node.js modules
// this is incompatible with Storybook. So we just mock the module
resolve: {
...config.resolve,
alias: {
'next/image': join(mocksFolder, './next-image.mjs'),
'next-intl/navigation': join(mocksFolder, './next-intl.mjs'),
'@/client-context': join(mocksFolder, './client-context.mjs'),
'@': join(__dirname, '../'),
},
},
// Removes Pesky Critical Dependency Warnings due to `next/font`
ignoreWarnings: [
e =>
e.message.includes('was not found in') ||
e.message.includes('generated code contains'),
],
}),
};
export default config;