-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyleguide.config.js
47 lines (43 loc) · 1.37 KB
/
styleguide.config.js
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
const path = require('path');
const webpack = require('webpack');
const { name: packageName, version, repository } = require('./package.json');
module.exports = {
// assetsDir: 'src/data',
usageMode: 'expand',
exampleMode: 'expand',
moduleAliases: {},
components: 'src/components/**/*.{js,jsx,ts,tsx}',
getComponentPathLine: (componentPath) => {
const name = path.basename(componentPath, '.jsx');
return `import { ${name} } from '${packageName}';`;
},
title: `${packageName} v${version}`,
ribbon: {
url: repository.url,
text: 'View on GitHub',
},
dangerouslyUpdateWebpackConfig(config) {
config.resolve.fallback = {
crypto: require.resolve('crypto-browserify'),
fs: false,
};
config.module.rules.push({
test: /.\.md$/,
type: 'javascript/auto',
});
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/react-styleguidist\/lib\/loaders\/utils\/client\/requireInRuntime$/,
'react-styleguidist/lib/loaders/utils/client/requireInRuntime'
)
);
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(
/react-styleguidist\/lib\/loaders\/utils\/client\/evalInContext$/,
'react-styleguidist/lib/loaders/utils/client/evalInContext'
)
);
return config;
},
};
module.exports.moduleAliases[packageName] = path.resolve(__dirname, 'src');