Created
December 24, 2016 18:41
-
-
Save pierrenel/0277362750877e786e00ae48f2b10643 to your computer and use it in GitHub Desktop.
Pierre's webpack config for Strawberry Fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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