Skip to content

Instantly share code, notes, and snippets.

Created February 12, 2017 21:23
Show Gist options
  • Save anonymous/0db52243713f1de865081ec73291caf4 to your computer and use it in GitHub Desktop.
Save anonymous/0db52243713f1de865081ec73291caf4 to your computer and use it in GitHub Desktop.
'use strict';
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'eval-source-map',
entry: {main: [
'webpack-hot-middleware/client?reload=true',
path.join(__dirname, './app/main.js')],
style: [
'webpack-hot-middleware/client?reload=true',
path.join(__dirname, './app/main.css')]},
output: {
path: path.join(__dirname, '/dist/'),
filename: '[name].js',
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin({
template: 'app/index.tpl.html',
inject: 'body',
filename: 'index.html'
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
}),
new ExtractTextPlugin("[name].css")
],
module: {
rules: [{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
"presets": ["react", ["es2015", { "modules": false }], "stage-0", "react-hmre"]
}
}, {
test: /\.json?$/,
loader: 'json'
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
}]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment