Skip to content

Instantly share code, notes, and snippets.

@z81
Last active October 7, 2015 09:33
Show Gist options
  • Save z81/938a729b334dcd4f1c35 to your computer and use it in GitHub Desktop.
Save z81/938a729b334dcd4f1c35 to your computer and use it in GitHub Desktop.
example webpack config
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: [
'./src/index'
],
devtool: 'source-map',
output: {
path: path.join(__dirname, 'public/dist'),
filename: 'bundle.js',
publicPath: '/dist/'
},
plugins: [
],
externals: {
},
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel?stage=0&optional[]=runtime'],
exclude: /node_modules/,
include: __dirname
},{
test: /\.less$/,
loaders: ['style', 'css', 'less'],
exclude: /node_modules/,
include: __dirname
},{
test: /\.css$/,
loaders: ['style', 'css'],
exclude: /node_modules/,
include: __dirname
},
{ test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/, loader: "url-loader?mimetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9].[0-9].[0-9])?$/, loader: "file-loader?name=[name].[ext]" },
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
}
]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment