Created
September 10, 2015 07:01
-
-
Save send2moran/d5b662551afc3e9b2bee to your computer and use it in GitHub Desktop.
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
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const port = process.env.HOT_LOAD_PORT || 8888; | |
const config = { | |
entry: { | |
app: [ | |
'./app/client.jsx', | |
], | |
vendor: ['react', 'react-router', 'flux', 'babel-core/polyfill.js'] | |
}, | |
output: { | |
path: path.join(__dirname, 'dist'), | |
filename: 'bundle.js', | |
publicPath: 'http://localhost:' + port + '/dist/' | |
}, | |
plugins: [ | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendor', | |
filename: 'vendor.bundle.js' | |
}), | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.NoErrorsPlugin(), | |
new ExtractTextPlugin('application.css', { | |
allChunks: true | |
}) | |
], | |
resolve: { | |
extensions: ['', '.js', '.jsx', '.scss', '.css'] | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.jsx?$/, | |
loaders: ['react-hot', 'babel?optional=runtime&stage=1'], | |
include: [ | |
path.resolve(__dirname, "../app"), | |
], | |
noParse: /babel\-core\/browser\-polyfill/ | |
}, | |
{ | |
test: /traceur-runtime/, | |
loader: 'imports?this=>window' | |
}, | |
{ | |
test: /\.css$/, | |
loader: ExtractTextPlugin.extract('style', 'css!autoprefixer?browsers=last 2 version') | |
}, | |
{ | |
test: /\.scss$/, | |
loader: ExtractTextPlugin.extract('style', 'css!autoprefixer?browsers=last 2 version!sass') | |
}, | |
{ | |
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'url?limit=10000&mimetype=application/font-woff&prefix=fonts' | |
}, | |
{ | |
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'url?limit=10000&mimetype=application/octet-stream&prefix=fonts' | |
}, | |
{ | |
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'url?limit=10000&mimetype=application/vnd.ms-fontobject&prefix=fonts' | |
}, | |
{ | |
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'url?limit=10000&mimetype=image/svg+xml&prefix=fonts' | |
}, | |
{ | |
test: /\.png$/, | |
loader: "url?limit=100000&mimetype=image/png", | |
}, | |
{ | |
test: /\.svg$/, | |
loader: "url?limit=100000&mimetype=image/svg+xml", | |
}, | |
{ | |
test: /\.gif$/, | |
loader: "url?limit=100000&mimetype=image/gif", | |
}, | |
{ | |
test: /\.jpg$/, | |
loader: "file", | |
}, | |
{ | |
test: /\.swf$/, | |
loader: "file" | |
} | |
] | |
} | |
}; | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment