2016-12-05 22:11:55 +02:00
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
const plugins = require('./plugins');
|
|
|
|
const base = require('./base');
|
2016-10-31 16:24:31 +02:00
|
|
|
const path = require('path');
|
2016-10-23 07:27:18 +03:00
|
|
|
|
2016-12-05 22:11:55 +02:00
|
|
|
const EmbedMarkdownLoader = path.join(__dirname, './embed-markdown-loader');
|
|
|
|
const STATIC = path.join(__dirname, '../static');
|
|
|
|
const SRC = path.join(__dirname, '../src');
|
|
|
|
const DOCS = path.join(__dirname, '../docs');
|
|
|
|
|
2016-10-23 07:27:18 +03:00
|
|
|
const devServer = {
|
2016-10-31 16:24:31 +02:00
|
|
|
contentBase: [
|
2016-12-05 22:11:55 +02:00
|
|
|
STATIC
|
2016-10-31 16:24:31 +02:00
|
|
|
],
|
2016-10-23 07:27:18 +03:00
|
|
|
hot: true,
|
|
|
|
compress: true,
|
|
|
|
lazy: false,
|
|
|
|
historyApiFallback: {
|
2016-10-31 16:24:31 +02:00
|
|
|
index: './index.html'
|
2016-10-23 07:27:18 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-12-05 22:11:55 +02:00
|
|
|
module.exports = Object.assign(base, {
|
2016-10-26 19:31:55 +03:00
|
|
|
entry: {
|
|
|
|
docs: [
|
2016-10-23 07:27:18 +03:00
|
|
|
'react-hot-loader/patch',
|
|
|
|
'webpack-dev-server/client?http://localhost:8080',
|
|
|
|
'webpack/hot/only-dev-server',
|
2016-10-26 19:31:55 +03:00
|
|
|
'./docs/index.js'
|
|
|
|
]
|
|
|
|
},
|
2016-12-05 22:11:55 +02:00
|
|
|
resolveLoader: {
|
|
|
|
alias: {
|
|
|
|
'embed-markdown-loader': EmbedMarkdownLoader
|
|
|
|
}
|
|
|
|
},
|
|
|
|
plugins: base.plugins.concat([
|
|
|
|
plugins['named-modules'],
|
|
|
|
plugins['hot-module-replacement'],
|
|
|
|
plugins['define']
|
2016-10-23 07:27:18 +03:00
|
|
|
]),
|
2016-12-05 22:11:55 +02:00
|
|
|
module: Object.assign(base.module, {
|
|
|
|
loaders: base.module.loaders.concat([{
|
|
|
|
test: /\.md?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
include: [
|
|
|
|
SRC,
|
|
|
|
DOCS
|
|
|
|
],
|
|
|
|
loader: 'raw-loader!embed-markdown-loader'
|
|
|
|
}, {
|
|
|
|
test: /\.css?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
include: [
|
|
|
|
SRC,
|
|
|
|
DOCS
|
|
|
|
],
|
|
|
|
loader: ExtractTextPlugin.extract({
|
|
|
|
fallbackLoader: 'style-loader',
|
|
|
|
loader: [
|
|
|
|
'css-loader?',
|
|
|
|
'modules&importLoaders=1&',
|
|
|
|
'localIdentName=[name]__[local]___[hash:base64:5]!',
|
|
|
|
'postcss-loader'
|
|
|
|
].join('')
|
|
|
|
})
|
|
|
|
}])
|
|
|
|
}),
|
2016-10-23 07:27:18 +03:00
|
|
|
devServer
|
|
|
|
});
|