-
Notifications
You must be signed in to change notification settings - Fork 2
/
styleguide.config.js
75 lines (73 loc) · 1.98 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
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
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');
const webpackConfig = {
mode: 'development',
devtool: 'cheap-module-eval-source-map',
devServer: {
disableHostCheck: true,
contentBase: path.resolve(__dirname, 'docs'),
},
entry: path.resolve(__dirname, 'src/index.js'),
module: {
rules: [
{
test: /\.jsx?$/,
loader: 'eslint-loader',
enforce: 'pre',
exclude: /node_modules/
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
// This has effect on the react lib size
NODE_ENV: JSON.stringify('production')
}
}),
],
resolve: {
extensions: ['.js', '.json', '.jsx']
}
};
module.exports = {
title: `React Component v${pkg.version}`,
sections: [
{
name: 'Repeatable',
content: path.resolve(__dirname, 'styleguide/examples/README.md'),
}
],
require: [
'@babel/polyfill',
path.resolve(__dirname, 'styleguide/setup.js'),
path.resolve(__dirname, 'styleguide/styles.css'),
],
ribbon: {
url: pkg.homepage,
text: 'Fork me on GitHub'
},
serverPort: 8080,
exampleMode: 'collapse',
usageMode: 'expand',
showSidebar: true,
styleguideComponents: {
StyleGuideRenderer: path.join(__dirname, 'styleguide/components/StyleGuideRenderer.jsx'),
Wrapper: path.join(__dirname, 'styleguide/components/Wrapper.jsx'),
},
styleguideDir: 'docs/',
webpackConfig: webpackConfig
};