Skip to content

Instantly share code, notes, and snippets.

@pierrenel
Created December 24, 2016 18:41
Show Gist options
  • Save pierrenel/0277362750877e786e00ae48f2b10643 to your computer and use it in GitHub Desktop.
Save pierrenel/0277362750877e786e00ae48f2b10643 to your computer and use it in GitHub Desktop.
Pierre's webpack config for Strawberry Fields
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var DashboardPlugin = require('webpack-dashboard/plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
entry: __dirname + '/src/index.jsx',
output: {
path: __dirname + '/dist',
filename: 'bundle.js',
},
module: {
devtool: 'cheap-module-source-map',
// preLoaders: [
// {
// test: /\.jsx?$/,
// loaders: ['eslint-loader'],
// exclude: /node_modules/
// }
// ],
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react'],
plugins: ['transform-decorators-legacy', 'transform-class-properties'],
}
},
{
test: /\.scss$/,
loaders: [ 'style', 'css?sourceMap', 'sass?sourceMap' ]
},
{
test: /\.(pdf)$/,
exclude: /node_modules/,
loader:'url-loader?limit=1024&name=pdf/[name].[ext]'
},
{
test: /\.(jpg|jpeg|gif|png)$/,
exclude: /node_modules/,
loader:'url-loader?limit=1024&name=images/[name].[ext]'
},
{
test: /\.(woff|woff2|eot|ttf|svg)$/,
exclude: /node_modules/,
loader: 'url-loader?limit=1024&name=fonts/[name].[ext]'
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'Strawberry Fields - Notting Hill',
template: 'public/index.html'
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
compress:{
warnings: false
}
}),
new DashboardPlugin(),
new ExtractTextPlugin('app.css', {
allChunks: true
})
],
resolve: {
modules: ['src', 'node_modules'],
extensions: [
'',
'.js',
'.jsx'
]
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment