react-static-webpack-plugin
Version:
Build full static sites using React, React Router and Webpack
56 lines (48 loc) • 1.2 kB
JavaScript
/* eslint-disable no-var */
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var ReactStaticPlugin = require('../../dist');
module.exports = {
devtool: 'source-map',
context: __dirname,
entry: {
app: ['./src/index.js'],
},
output: {
path: path.join(__dirname, 'public'),
filename: '[name].js',
publicPath: '/',
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production'),
},
}),
new webpack.optimize.UglifyJsPlugin({
screw_ie8: true,
compressor: { warnings: false },
}),
new ReactStaticPlugin({
component: './src/components/App.js',
template: './template.js',
stylesheet: '/app.css',
}),
new ExtractTextPlugin('[name].css', { allChunks: true }),
],
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel'],
exclude: path.join(__dirname, 'node_modules'),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css'),
},
],
},
};