-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
71 lines (70 loc) · 1.96 KB
/
webpack.config.js
File metadata and controls
71 lines (70 loc) · 1.96 KB
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
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
var autoprefixer = require('autoprefixer');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: './src/assets/js/entry.js',
output: {
path: __dirname + "/public/assets/js/",
filename: 'main.min.js'
},
plugins: debug ? [
new ExtractTextPlugin("../css/main.min.css", {
allChunks: true
}),
new BrowserSyncPlugin({
proxy: 'http://webpack.dev/',
files: ['src/**/*'],
notify: false
})
] : [
new ExtractTextPlugin("../css/main.min.css", {
allChunks: true
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({ sourceMap: false, mangle: false, compress: { warnings: false }})
],
module: {
preLoaders: [
{
test: /\.jsx?$/,
loader: 'eslint-loader',
include: __dirname + '/src/assets/js/'
}
],
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: debug ? 'babel-loader' : 'strip?strip[]=console.log!babel-loader?cacheDirectory'
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract("style-loader", ["css-loader", "postcss-loader", "sass-loader"])
},
{
test: /.*\.(png|jpe?g|gif|svg)$/i,
loaders: [
'file?name=../img/[name].[ext]',
'image-webpack?{progressive:true, optimizationLevel: 5, interlaced: false, pngquant:{quality: "65-90", speed: 4}}'
]
},
{
test: /\.(html|php)$/,
loader: "file?name=../../[name].[ext]"
}
]
},
postcss: [
autoprefixer({
browsers: ['last 2 versions']
})
],
resolve: {
extensions: ['', '.js', '.jsx', '.css', '.scss', 'html', 'php']
}
};