forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs.config.js
51 lines (43 loc) · 1.66 KB
/
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
import _ from 'lodash-compat';
import webpack from 'webpack';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import baseConfig, { options, jsLoader } from './base.config';
import ip from 'ip';
const webpackDevServerAddress = `http://${ip.address()}:${options.port}`;
const cssSourceMap = options.debug ? '?sourceMap' : '';
const reactHot = options.debug ? 'react-hot!' : '';
const entryFile = './docs/client.js';
const devEntryBundle = [
'webpack/hot/dev-server',
`webpack-dev-server/client?${webpackDevServerAddress}`,
entryFile
];
baseConfig.plugins.push(new ExtractTextPlugin('[name].css'));
if (options.debug) {
baseConfig.plugins.push(new webpack.NoErrorsPlugin());
}
export default _.extend({}, baseConfig, {
devtool: options.debug ? 'source-map' : null,
entry: {
bundle: options.debug ? devEntryBundle : entryFile
},
output: {
filename: '[name].js',
path: './docs-built/assets',
publicPath: options.debug ? `${webpackDevServerAddress}/assets/` : '/assets/'
},
module: {
noParse: /babel-core\/browser/,
loaders: [
{ test: /\.js/, loader: `${reactHot}${jsLoader}`, exclude: /node_modules|Samples\.js/ },
{ test: /Samples.js/, loader: `${reactHot}transform?brfs!${jsLoader}` },
{ test: /\.css/,
loader: ExtractTextPlugin.extract('style', `css${cssSourceMap}`) },
{ test: /\.less$/,
loader: ExtractTextPlugin.extract('style', `css${cssSourceMap}!less${cssSourceMap}`) },
{ test: /\.json$/, loader: 'json' },
{ test: /\.jpe?g$|\.gif$|\.png|\.ico$/, loader: 'file?name=[name].[ext]' },
{ test: /\.eot$|\.ttf$|\.svg$|\.woff2?$/, loader: 'file?name=[name].[ext]' }
]
}
});