2015-12-19 14:52:17 +01:00
|
|
|
var webpack = require('webpack');
|
|
|
|
var path = require('path');
|
|
|
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
|
|
|
|
|
|
|
|
var options = {
|
|
|
|
entry: {
|
|
|
|
'app': './js/app.js',
|
|
|
|
'styles': './scss/main.scss'
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.dirname(__dirname) + '/assets/static',
|
|
|
|
filename: '[name].js'
|
|
|
|
},
|
|
|
|
devtool: '#cheap-module-source-map',
|
|
|
|
resolve: {
|
|
|
|
modulesDirectories: ['node_modules'],
|
|
|
|
extensions: ['', '.js']
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /node_modules/,
|
2016-07-22 22:37:35 +02:00
|
|
|
loader: 'babel',
|
|
|
|
query: {
|
|
|
|
presets: ['es2015'],
|
|
|
|
}
|
2015-12-19 14:52:17 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(woff2?|ttf|eot|svg|png)(\?.*?)?$/,
|
|
|
|
loader: 'file'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
2016-07-22 22:37:35 +02:00
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: {
|
|
|
|
warnings: false
|
|
|
|
}
|
|
|
|
}),
|
2015-12-19 14:52:17 +01:00
|
|
|
new webpack.optimize.DedupePlugin(),
|
|
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
$: 'jquery',
|
|
|
|
jQuery: 'jquery'
|
|
|
|
}),
|
|
|
|
new ExtractTextPlugin('styles.css', {
|
|
|
|
allChunks: true
|
|
|
|
})
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = options;
|