forked from steemit/condenser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
storybook.config.js
85 lines (82 loc) · 2.28 KB
/
storybook.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
76
77
78
79
80
81
82
83
84
85
import path from 'path';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import genDefaultConfig from '@storybook/react/dist/server/config/defaults/webpack.config.js';
import webpack from 'webpack';
const css_loaders = [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'autoprefixer-loader'
}
];
const scss_loaders = [
{
loader: 'css-loader',
},
{
loader: 'autoprefixer-loader'
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
data: '@import "app";',
includePaths: [
path.join(__dirname, '../src/app/assets/stylesheets'),
]
}
},
];
module.exports = (baseConfig, env) => {
const config = genDefaultConfig(baseConfig, env);
config.resolve = {
alias: {
react: path.join(__dirname, '../node_modules', 'react'),
assets: path.join(__dirname, '../src/app/assets'),
decorators: path.join(__dirname, '../.storybook/decorators')
},
extensions: ['.js', '.json', '.jsx'],
modules: [
path.resolve(__dirname, '../src'),
'node_modules'
]
};
config.plugins.push( new ExtractTextPlugin('[name]-[chunkhash].css'));
config.plugins.push(new webpack.DefinePlugin({
'process.env': {
BROWSER: JSON.stringify(true),
}
}));
config.module = {
rules: [
{test: /\.(jpe?g|png)/, use: 'url-loader?limit=4096'},
{test: /\.json$/, use: 'json-loader'},
{test: /\.js$|\.jsx$/, exclude: /node_modules/, use: 'babel-loader'},
{test: /\.svg$/, use: 'svg-inline-loader'},
{
test: require.resolve("blueimp-file-upload"),
use: "imports?define=>false"
},
{
test: /\.css$/,
use: css_loaders
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: scss_loaders
})
},
{
test: /\.md/,
use: 'raw-loader'
}
]
};
return config;
};