-
Notifications
You must be signed in to change notification settings - Fork 16
/
webpack.config.js
41 lines (41 loc) · 1.58 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
var path = require("path");
var NormalModuleReplacementPlugin = require("webpack/lib/NormalModuleReplacementPlugin");
module.exports = {
context: __dirname,
entry: "./app/app.js",
output: {
path: path.join(__dirname, "assets"),
publicPath: "assets/",
filename: "main.js",
chunkFilename: "[hash].[id].js"
},
module: {
loaders: [
{ test: /\.json$/, loader: "json-loader" },
{ test: /\.coffee$/, loader: "coffee-loader" },
{ test: /\.css$/, loader: "style-loader!css-loader" },
{ test: /\.less$/, loader: "style-loader!css-loader!less-loader" },
{ test: /\.jade$/, loader: "jade-loader?self" },
{ test: /\.png$/, loader: "url-loader?prefix=img/&limit=5000&minetype=image/png" },
{ test: /\.jpg$/, loader: "url-loader?prefix=img/&limit=5000&minetype=image/jpg" },
{ test: /\.gif$/, loader: "url-loader?prefix=img/&limit=5000&minetype=image/gif" },
{ test: /\.woff$/, loader: "url-loader?prefix=font/&limit=5000&minetype=application/font-woff" }
],
preLoaders: [
{
test: /\.js$/,
include: pathToRegExp(path.join(__dirname, "app")),
loader: "jshint-loader"
}
]
},
provide: {
"__webpack_require_loader__": path.join(__dirname, "app", "webpackLoaders.js")
},
cache: true,
plugins: [
new NormalModuleReplacementPlugin(/node_modules.jade.index\.js$/, path.join(require.resolve("jade-loader"), "..", "node_modules", "jade", "lib", "jade.js"))
]
};
function escapeRegExpString(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); }
function pathToRegExp(p) { return new RegExp("^" + escapeRegExpString(p)); }