forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.docs.config.js
119 lines (115 loc) · 2.8 KB
/
webpack.docs.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/* eslint import/no-extraneous-dependencies: 0 */
const path = require('path');
const webpack = require('webpack');
const StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const env = process.env.WEBPACK_BUILD || process.env.NODE_ENV || 'development';
const paths = [
'/',
'/components/',
'/components/layout/',
'/components/navs/',
'/components/navbar/',
'/components/breadcrumbs/',
'/components/buttons/',
'/components/button-group/',
'/components/button-toolbar/',
'/components/button-dropdown/',
'/components/dropdowns/',
'/components/form/',
'/components/input-group/',
'/components/popovers/',
'/components/progress/',
'/components/tooltips/',
'/components/modals/',
'/components/badge/',
'/components/card/',
'/components/tables/',
'/components/media/',
'/components/pagination/',
'/components/tabs/',
'/components/jumbotron/',
'/components/alerts/',
'/components/toasts/',
'/components/collapse/',
'/components/carousel/',
'/components/listgroup/',
'/components/spinners/',
'/utilities/',
'/utilities/colors/',
'/utilities/clearfix/',
'/premium-themes/',
'/404.html'
];
const config = {
mode: env,
devtool: 'source-map',
devServer: {
inline: false,
disableHostCheck: true,
contentBase: './build',
historyApiFallback: true,
stats: {
chunks: false
}
},
entry: './docs/lib/app',
node: {
fs: 'empty'
},
output: {
filename: 'bundle.js',
path: path.resolve('./build'),
libraryTarget: 'umd',
// globalObject: '(typeof self !== \'undefined\' ? self : this)'
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin({
patterns: [{ from: './docs/static', to: 'assets' }]
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(env)
}),
new StaticSiteGeneratorPlugin({
paths,
globals: {
window: { },
}
}),
new MiniCssExtractPlugin({
filename: 'assets/[name].css',
chunkFilename: 'assets/[id].css'
})
],
module: {
rules: [
{
test: /\.json$/,
use: 'json-loader?cacheDirectory'
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: 'babel-loader?cacheDirectory'
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
]
},
resolve: {
extensions: ['.js', '.json'],
alias: {
'bootstrap-css': path.join(__dirname, 'node_modules/bootstrap/dist/css/bootstrap.css'),
reactstrap: path.resolve('./src')
}
}
};
module.exports = config;