forked from saleor/saleor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
87 lines (81 loc) · 2.01 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var autoprefixer = require('autoprefixer');
var BundleTracker = require('webpack-bundle-tracker');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var path = require('path');
var webpack = require('webpack');
var bundleTrackerPlugin = new BundleTracker({
filename: 'webpack-bundle.json'
});
var commonsChunkPlugin = new webpack.optimize.CommonsChunkPlugin('vendor', '[name].[chunkhash].js');
var extractTextPlugin = new ExtractTextPlugin(
'[name].[chunkhash].css'
);
var providePlugin = new webpack.ProvidePlugin({
$: 'jquery',
'_': 'underscore',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Backbone: 'backbone',
'window.Backbone': 'backbone',
Hammer: 'hammerjs'
});
var config = {
entry: {
cart: './saleor/static/js/cart.js',
dashboard: './saleor/static/js/dashboard.js',
storefront: './saleor/static/js/storefront.js',
vendor: [
'bootstrap-sass',
'jquery',
'jquery.cookie'
]
},
output: {
path: path.resolve(__dirname, 'saleor/static/assets/'),
filename: '[name].[chunkhash].js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract([
'css?sourceMap',
'postcss',
'sass'
])
},
{
test: /\.(eot|otf|png|svg|ttf|woff|woff2)(\?v=[0-9.]+)?$/,
loader: 'file?name=[name].[hash].[ext]',
include: [
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'saleor/static/fonts'),
path.resolve(__dirname, 'saleor/static/images'),
path.resolve(__dirname, 'saleor/static/img')
]
}
]
},
plugins: [
bundleTrackerPlugin,
commonsChunkPlugin,
extractTextPlugin,
providePlugin
],
postcss: function() {
return [autoprefixer];
},
sassLoader: {
sourceMap: true
}
};
module.exports = config;