lektor-website/webpack/webpack.config.js

63 lines
1.3 KiB
JavaScript

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/,
loader: 'babel',
query: {
presets: ['es2015'],
}
},
{
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: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
new ExtractTextPlugin('styles.css', {
allChunks: true
})
]
};
module.exports = options;