-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
Copy pathpreview-preset.ts
32 lines (26 loc) · 951 Bytes
/
preview-preset.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
import webpackConfig from '../preview/iframe-webpack.config';
export const webpack = async (_: unknown, options: any) => webpackConfig(options);
export const entries = async (_: unknown, options: any) => {
let result: string[] = [];
result = result.concat(await options.presets.apply('previewEntries', [], options));
if (options.configType === 'DEVELOPMENT') {
// Suppress informational messages when --quiet is specified. webpack-hot-middleware's quiet
// parameter would also suppress warnings.
result = result.concat(
`${require.resolve('webpack-hot-middleware/client')}?reload=true&quiet=false&noInfo=${
options.quiet
}`
);
}
return result;
};
export const babel = async (config: any, options: any) => ({
...config,
overrides: [
...(config?.overrides || []),
{
test: /\.(story|stories).*$/,
plugins: [require.resolve('babel-plugin-named-exports-order')],
},
],
});