2015-10-23 21:02:42 +03:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const autoprefixer = require('autoprefixer');
|
2015-10-25 22:02:48 +03:00
|
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
2015-10-26 12:47:53 +03:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
const TransferWebpackPlugin = require('transfer-webpack-plugin');
|
2015-10-23 02:50:05 +03:00
|
|
|
|
|
|
|
module.exports = {
|
2015-10-23 21:02:42 +03:00
|
|
|
context: __dirname,
|
2015-10-29 08:33:21 +03:00
|
|
|
entry: ['./app/index.jsx'],
|
2015-10-23 21:02:42 +03:00
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'build'),
|
2015-10-26 12:47:53 +03:00
|
|
|
filename: 'docs.js'
|
|
|
|
},
|
2015-10-23 02:50:05 +03:00
|
|
|
resolve: {
|
2015-10-29 14:07:08 +03:00
|
|
|
extensions: ['', '.jsx', '.scss', '.js', '.json', '.md'],
|
2016-04-10 12:38:42 +03:00
|
|
|
packageMains: ['browser', 'web', 'browserify', 'main', 'style'],
|
2015-10-23 02:50:05 +03:00
|
|
|
alias: {
|
|
|
|
'react-toolbox': path.resolve(__dirname + './../components')
|
|
|
|
},
|
|
|
|
modulesDirectories: [
|
|
|
|
'node_modules',
|
|
|
|
path.resolve(__dirname, './node_modules'),
|
2015-10-25 22:02:48 +03:00
|
|
|
path.resolve(__dirname, './../node_modules'),
|
|
|
|
path.resolve(__dirname, './../components')
|
2015-10-23 02:50:05 +03:00
|
|
|
]
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
2015-10-23 21:02:42 +03:00
|
|
|
{
|
2015-12-24 00:21:41 +03:00
|
|
|
test: /\.(js|jsx)$/,
|
2015-10-23 21:02:42 +03:00
|
|
|
exclude: /(node_modules)/,
|
2015-10-29 08:33:21 +03:00
|
|
|
loader: 'babel'
|
2015-10-23 21:02:42 +03:00
|
|
|
}, {
|
2015-12-24 00:21:41 +03:00
|
|
|
test: /\.(scss|css)$/,
|
2015-11-03 11:51:18 +03:00
|
|
|
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass!toolbox')
|
2015-10-25 16:54:41 +03:00
|
|
|
}, {
|
2015-12-24 00:21:41 +03:00
|
|
|
test: /\.(txt)$/,
|
2015-10-25 22:02:48 +03:00
|
|
|
loader: 'raw',
|
2015-11-02 00:55:23 +03:00
|
|
|
include: path.resolve(__dirname, './app/components/layout/main/modules')
|
2015-10-29 14:07:08 +03:00
|
|
|
}, {
|
2015-12-24 00:21:41 +03:00
|
|
|
test: /\.(md)$/,
|
2015-11-02 00:59:25 +03:00
|
|
|
loader: 'html?removeComments=false!highlight!markdown'
|
2015-10-23 21:02:42 +03:00
|
|
|
}
|
2015-10-23 02:50:05 +03:00
|
|
|
]
|
|
|
|
},
|
2015-10-23 21:02:42 +03:00
|
|
|
postcss: [autoprefixer],
|
|
|
|
plugins: [
|
2015-10-29 13:38:42 +03:00
|
|
|
new ExtractTextPlugin('docs.css', { allChunks: true }),
|
2015-10-26 12:47:53 +03:00
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: { warnings: false }
|
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
inject: false,
|
|
|
|
template: path.resolve(__dirname, './www/index.html')
|
|
|
|
}),
|
2015-10-29 08:33:21 +03:00
|
|
|
new TransferWebpackPlugin([{
|
|
|
|
from: 'www/images',
|
|
|
|
to: 'images'
|
2015-11-02 12:43:11 +03:00
|
|
|
}, {
|
2015-11-02 13:03:58 +03:00
|
|
|
from: 'www/other'
|
2015-11-02 04:09:28 +03:00
|
|
|
}], path.resolve(__dirname, './')),
|
2015-10-29 11:28:49 +03:00
|
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
2015-10-29 08:33:21 +03:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env.NODE_ENV': JSON.stringify('production')
|
|
|
|
})
|
2015-10-23 21:02:42 +03:00
|
|
|
]
|
2015-10-23 02:50:05 +03:00
|
|
|
};
|