-
Notifications
You must be signed in to change notification settings - Fork 66
/
webpack.config.js
53 lines (50 loc) · 1.78 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
var path = require('path');
var webpack = require('webpack');
var BundleTracker = require('webpack-bundle-tracker');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
context: __dirname,
entry: {
index: './webpack_js/index',
portal: './webpack_js/portal',
oss: './webpack_js/oss'
},
output: {
path: path.resolve('./static/webpack_bundles/'),
filename: "[name]-[hash].js"
},
module: {
loaders: [
// Extract css files
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })
},
// Optionally extract less files
// or any other compile-to-css language
{
test: /\.less$/i,
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: "css-loader!less-loader" })
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: "css-loader!sass-loader!image-webpack-loader?bypassOnDebug&optimizationLevel=7&interlaced=false" })
},
{test: /\.(jpe?g|png|gif|svg)$/i, loaders: [
'file-loader?hash=sha512&digest=hex&name=[hash].[ext]',
'image-webpack-loader?bypassOnDebug&optimizationLevel=7&interlaced=false'
]},
// Optionally extract less files
// or any other compile-to-css language
// You could also use other loaders the same way. I. e. the autoprefixer-loader
]
},
externals: {
},
plugins: [
new BundleTracker({filename: './webpack-stats.json'}),
new ExtractTextPlugin({
filename: "[name]-[hash].css",
allChunks: true
}) ]
}