react-toolbox/docs/webpack.config.production.js

66 lines
1.8 KiB
JavaScript
Raw Normal View History

2015-10-23 21:02:42 +03:00
const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
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'),
filename: 'docs.js'
},
devServer: {
contentBase: '/build'
2015-10-23 21:02:42 +03:00
},
2015-10-23 02:50:05 +03:00
resolve: {
2015-10-23 21:02:42 +03:00
extensions: ['', '.jsx', '.scss', '.js', '.json'],
2015-10-23 02:50:05 +03:00
alias: {
'react-toolbox': path.resolve(__dirname + './../components')
},
modulesDirectories: [
'node_modules',
path.resolve(__dirname, './node_modules'),
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
{
test: /(\.js|\.jsx)$/,
exclude: /(node_modules)/,
2015-10-29 08:33:21 +03:00
loader: 'babel'
2015-10-23 21:02:42 +03:00
}, {
test: /(\.scss|\.css)$/,
2015-10-29 11:07:29 +03:00
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass')
2015-10-25 16:54:41 +03:00
}, {
test: /(\.txt)$/,
loader: 'raw',
2015-10-25 16:54:41 +03:00
include: path.resolve(__dirname, './app/examples')
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: [
new ExtractTextPlugin('docs.css', {allChunks: true}),
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'
}], 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
};