56 lines
1.2 KiB
JavaScript
56 lines
1.2 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-loader'
|
||
|
},
|
||
|
{
|
||
|
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(),
|
||
|
new webpack.optimize.DedupePlugin(),
|
||
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||
|
new webpack.ProvidePlugin({
|
||
|
$: 'jquery',
|
||
|
jQuery: 'jquery'
|
||
|
}),
|
||
|
new ExtractTextPlugin('styles.css', {
|
||
|
allChunks: true
|
||
|
})
|
||
|
]
|
||
|
};
|
||
|
|
||
|
module.exports = options;
|