mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 19:01:05 +08:00
29 lines
788 B
TypeScript
29 lines
788 B
TypeScript
import path from 'path';
|
|
import { TransformOptions } from '@babel/core';
|
|
import { Configuration } from 'webpack';
|
|
|
|
export function babelDefault(config: TransformOptions) {
|
|
return {
|
|
...config,
|
|
plugins: [
|
|
...config.plugins,
|
|
[require.resolve('@babel/plugin-transform-react-jsx'), { pragma: 'h' }, 'preset'],
|
|
],
|
|
};
|
|
}
|
|
|
|
export function webpackFinal(config: Configuration) {
|
|
return {
|
|
...config,
|
|
resolve: {
|
|
...config.resolve,
|
|
alias: {
|
|
...config.resolve.alias,
|
|
react: path.dirname(require.resolve('preact/compat/package.json')),
|
|
'react-dom/test-utils': path.dirname(require.resolve('preact/test-utils/package.json')),
|
|
'react-dom': path.dirname(require.resolve('preact/compat/package.json')),
|
|
},
|
|
},
|
|
};
|
|
}
|