Last active
June 2, 2017 18:17
-
-
Save Eireen/b235013758311ceb79e7d8016a231bd3 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 path = require('path'); | |
const webpack = require('webpack'); | |
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin'); | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
path: path.resolve(__dirname, '../dist'), | |
filename: '[name].js' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader', | |
options: { | |
presets: [ | |
['env', { | |
targets: { | |
uglify: true | |
} | |
}], | |
'react' | |
], | |
plugins: ["transform-class-properties"] | |
} | |
}, | |
{ | |
test: /\.css$/, | |
use: ExtractTextPlugin.extract({ | |
use: [ | |
'css-loader', | |
'svg-fill-loader/encodeSharp' // See https://www.npmjs.com/package/svg-fill-loader#using-with-css-loader | |
] | |
}) | |
}, | |
{ | |
test: /\.svg$/, | |
exclude: /src\/fonts/, | |
use: [ | |
'svg-sprite-loader', | |
'svg-fill-loader', | |
'svgo-loader' | |
] | |
}, | |
{ | |
test: /(\.(png|jpg|gif|woff|woff2|eot|ttf|otf)|\/src\/fonts\/.+\.svg)$/, | |
loader: 'file-loader', | |
options: { | |
name: '[name].[hash].[ext]' | |
} | |
} | |
] | |
}, | |
plugins: [ | |
new ExtractTextPlugin('styles.css'), | |
new SpriteLoaderPlugin(), | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendor', | |
minChunks: function(module) { | |
return module.context && ~module.context.indexOf('node_modules'); | |
} | |
}), | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'manifest' | |
}), | |
new HtmlWebpackPlugin({ | |
template: 'pug-loader!src/index.pug' | |
}) | |
], | |
resolve: { | |
alias: { | |
App: path.resolve(__dirname, '../src') | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment