storybook/addons/docs/common/makePreset.js
2019-07-29 15:57:20 +08:00

21 lines
531 B
JavaScript

const fs = require('fs');
const common = require('./preset');
module.exports = framework => {
const frameworkConfig = `${__dirname}/../${framework}/config.js`;
const preConfig = fs.existsSync(frameworkConfig) ? [frameworkConfig] : [];
function config(entry = []) {
return [...preConfig, ...entry];
}
const configureJSX = framework !== 'react';
const webpack = (webpackConfig, options) =>
common.webpack(webpackConfig, { configureJSX, ...options });
return {
...common,
webpack,
config,
};
};