-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
56 lines (54 loc) · 1.61 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
var webpack = require("webpack");
var Path = require("path");
var exec = require('child_process').exec;
exec("find img/* -name '*'", function(err, data){
var files = data.split("\n").slice(0, -1);
exec("echo '" + JSON.stringify(files) + "' > src/img.json");
});
module.exports = {
context: Path.resolve('./'),
optimize: "uglify",
entry: {
'entry': Path.resolve('src/entry.js')
},
resolve: {
root: [
Path.resolve('./')
],
extensions: ['', '.js', '.json', ".css", ".less", ".html"]
},
output: {
path: Path.resolve("dist"),
publicPath: '/dist/',
filename: "[name].js",
chunkFilename: "[name].js"
},
plugins: [
new webpack.optimize.UglifyJsPlugin({minimize: true})
],
module: {
loaders: [
{ test: /\.less$/, loader: 'style/useable!css!postcss-loader!less' },
{ test: /\.css$/, loader: "style/useable!css!postcss-loader" },
{ test: /\.png$/, loader: "url-loader?limit=100000" },
{ test: /\.jpg$/, loader: "url-loader?limit=100000" },
{ test: /\.svg$/, loader: "url-loader?limit=100000" },
{ test: /\.html$/, loader: "raw" },
{ test: /\.json$/, loader: "json" }
],
postLoaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'jshint-loader'
}
]
},
jshint: {
emitErrors: true,
failOnHint: false,
},
postcss: function () {
return [require('autoprefixer'), require('precss')];
}
};